Re: [xml] Can I read namespace URIs as regular attributes?
- From: Daniel Veillard <veillard redhat com>
- To: Jianqing Zhang <arrow jianqing gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] Can I read namespace URIs as regular attributes?
- Date: Sat, 5 Sep 2009 21:59:09 +0200
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/
daniel veillard com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]