Re: [xml] Namespace question

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Sun Oct 29 2000 - 12:35:39 EST


On Sun, Oct 29, 2000 at 04:33:06PM +0000, Bjorn Reese wrote:
>
> What is the difference between ns and nsDef in struct _xmlNode in
> tree.h?

  very simple:
    - ns is a pointer to the namepsace associated to the node
    - nsDef on elements is the lists of namespace definitions
      made on this element

For example:

<?xml version="1.0"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns="http://my.netscape.com/rdf/simple/0.9/">
    <channel>
    ....

  The top level element RDF will have 2 entries in the nsDef list
and its ns field will point to the rdf one. The channel element
will ahve an empty nsDef and it's ns will point to the other namespace.

> The reason I ask is that I have a situation where xmlSearchNsByHref()
> enters an infinite loop because nsDef is NULL (ns does contain data).
> I strongly suspect that the 16th line in xmlSearchNsByHref(), which
> is
>
> while (check != node) {
>
> should be
>
> if (check != node) {
>
> If I make this modification, the my program seems to work.
>
> Then again, I am searching on a tree during its construction, so I
> may be doing something illegal (or at least unexpected).

  Well actually the bug is somewhere else :-) . The loop should recurse
on the parent, and this is missing. 1 line patch enclosed ...

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/


----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sun Oct 29 2000 - 12:44:01 EST