Re: [xml] Can I read namespace URIs as regular attributes?
- From: Daniel Veillard <veillard redhat com>
- To: Emmanuel Rodriguez <emmanuel rodriguez gmail com>
- Cc: xml gnome org
- Subject: Re: [xml] Can I read namespace URIs as regular attributes?
- Date: Mon, 7 Sep 2009 15:15:54 +0200
On Sun, Sep 06, 2009 at 04:53:14PM +0200, Emmanuel Rodriguez wrote:
On Thu, Sep 3, 2009 at 12:39 AM, Jianqing Zhang <arrow jianqing gmail com>wrote:
Thanks Michael. I'm using C++ and have not figured it out. I'm
wondering how I can get these namespace URIs. information
The following xpath expression ".//namespace::*" can find all namespaces
declarations in a document and it works with xmllint --shell and XML::LibXML
(perl).
but again it makes very little sense as a namespace declaration is
just valid under the element subtree where it's declared, and it's
perfectly possible to have the same prefix bound to different
namespaces, not recommended but perfectly legal:
<foo:foo xmlns:foo="http://eample.com/foo">
<foo:foo xmlns:foo="http://eample.com/bar">
<foo:bar/>
</foo:foo>
</foo:foo>
So again basically doing that search is just a garantee that the
code it will be used for will break in weird ways when the input is not
as expected.
In a nutshell Don't Do That !
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]