Re: [Tutor] XML node name and property
Keo Sophon wrote: Hi all, How can I get a name of an XML node and and its property name and its property value? How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] XML node name and property
On Friday 31 March 2006 17:37, Kent Johnson wrote: Keo Sophon wrote: Hi all, How can I get a name of an XML node and and its property name and its property value? How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor I am using xml.dom. Phon ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] XML node name and property
Keo Sophon wrote: On Friday 31 March 2006 17:37, Kent Johnson wrote: Keo Sophon wrote: How can I get a name of an XML node and and its property name and its property value? How are your reading the XML? (xml.dom, ElementTree, BeautifulSoup...) I am using xml.dom. I generally use ElementTree for XML access, it is much simpler than xml.dom. But here is what I figured out: The tag name is node.nodeName If by property you mean attribute, you can get a list of all attributes by node.attributes.keys() and access the value of a particular one by node.attributes['attributeName'].nodeValue Google python xml.dom to find many more examples. Or Google ElementTree to find an easier way to do it... Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] XML node name and property
Hi all, How can I get a name of an XML node and and its property name and its property value? Thanks, Sophon ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor