Re: [xml] Namespace Handling



On Wed, Sep 10, 2003 at 09:41:59AM +0100, Balint Joo wrote:
I saw this function and wondered what it did. Let me see if I have this
straight:

When I parse a document my 'current' node is the 'root' node. I then

  that function applied to the root node would return a list
of the namespace defined on the root node.

Then I can do queries from there with namespaces
(eg //bj:gnus )?

  if bj is defined on the root node, then fine, if not it won't
work, and it *can't* work, because bj might be mapped to "foo"
in one space of your tree and "bar" in another part of the tree
and "bar" namespace you might be looking for might be defined
as the bk prefix on the root node !
 <root xmlns:bk="bar">
    <c xmlns:bj="foo">
       <bj:gnus>
    </c>
    <c xmlns:bj="bar">
       <bj:gnus>
    </c>
 </root>

 Your algorithm looking for gnus in "bar" namespace might simply
not select the right nodes !

Sorry to be such a dummy. This is really the last hurdle for me and
would like to get it done :)

  You're making one fundamental mistake. The prefixes are not important
what is important is the namespace name. You search for gnus in "bar"
namespace and that can be expressed as
   bk mapped to "bar"
   //bk:gnus
 even if in the instance it uses the bj prefix.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]