bug-gnustep
[Top][All Lists]
Advanced

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

Re: GSXML test failures


From: Nicola Pero
Subject: Re: GSXML test failures
Date: Thu, 14 Mar 2002 15:15:00 +0000 (GMT)

> I don't understand the relationships of namespaces to nodes though.  Why
> should a namespace be associated with a particular node?
> Could we say that all namespaces must belong to a document rather than a 
> node?

A namespace appears in a document in the form of a node, which declares a
new namespace.  For example,

<overlay xmlns:html="http://www.w3.org/1999/xhtml";>

</overlay>

'overlay' is a normal node.  The xmlns declarations declare that tags like 
<html:p> are valid in the node content, and should be validated/processed
in a different way.

In other words, all children of that <overlay> node can be made to be in
that namespace.

As soon as the <overlay> tag is closed, the namespace is no longer
visible, and you can't any longer put any <html:xxx> tags.  Unless you
declare the namespace again ... but you can use a different prefix and/or
url ... so it's really a new different namespace!

What libxml2 does is, when it finds the opening <overlay> node declaring
the namespace, it creates a namespace struct describing the namespace.  
All nodes have a list of namespaces they belong to.  In this case, all
subnodes of <overlay> might belong to the namespace html declared in
<overlay>.

The namespace struct is owned by the node which declares it (the fact that
subnodes of this node belong to this namespace does not affect the memory
management of the namespace - ie, they don't retain it ... which might be
considered a memory bug in libxml2 even if it rarely - if ever - will show
up).  When the <overlay> node is freed, all the namespaces it declares are
freed.

I need to think more about how to redesign the API so that it works.  Let
me know if you have suggestions.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]