XML/XPath: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 217: | Line 217: | ||
xmlfile = file("test3.xml") # load xml document from file |
xmlfile = file("test3.xml") # load xml document from file |
||
xmldoc = xmldom.parse(xmlfile).documentElement # parse from file stream |
xmldoc = xmldom.parse(xmlfile).documentElement # parse from file stream or... |
||
xmldoc = xmldom.parseString("<inventory title="OmniCorp Store #45x10^3">...</inventory>").documentElement # |
xmldoc = xmldom.parseString("<inventory title="OmniCorp Store #45x10^3">...</inventory>").documentElement # alternatively, parse a string |
||
# 1st Task: Retrieve the first "item" element |
# 1st Task: Retrieve the first "item" element |