On Tue, Sep 01, 2009 at 10:30:37PM -0500, Jianqing Zhang wrote: > I'm trying to read all namespace URIs by go through all attributes of > the root element. Can I read them as regular attributes?
No, basically libxml2 separates the namespaces when parsing, and move them out of the attribute list. Check an xmlNode structure, if it uses a namespaces then it has an ns pointer pointing to the namespace declaration. And when a namespace is declared the associated xmlNode of type XML_ELEMENT_NODE will have it on its nsDef list of namespaces. Note that: 1/ the root element may not carry all namespaces for the document 2/ there is no routine to search for all namespace declarations within a document (doesn't make much sense) but there is a routine listing all the namespaces in scope on a given node (xmlGetNsList) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml