Re: [xml] libxml2 and default namespaces



On Saturday 10 December 2005 17:54, Daniel Veillard wrote:
On Sat, Dec 10, 2005 at 05:39:42PM +0100, Paul Boddie wrote:
So, by defining a root element with namespace URI as "DAV:" and
qualified name "href", the discussion focused on whether the correct
serialisation would be this...

<?xml version='1.0'?>
<href xmlns='DAV:'/>

...or this...

<?xml version='1.0'?>
<href/>

   in the second case the root element has no namespace. So this can't
match your assertion 'root element with namespace URI as "DAV:"'. Obviously
in the second case the element has no namespace.

The disagreement came about in talking about the setting (or definition) of a 
namespace on the "href" element, which would be done through a DOM (or other) 
API, and whether it is the responsibility of that API to ensure that 
namespaces are declared in the serialised document or not.

Personally, my mental model is that one gives elements names which may have 
some kind of namespace associated with them - what one might informally call 
"setting a namespace on an element", although that isn't necessarily the same 
thing, and that's why I called my own knowledge of the libxml2 API into 
question - and whether such namespace information appears in the output is a 
separate issue from the DOM (or other) API.

  I didn't check further, this sounds completely flawed from the start.

That setting a namespace on an element and then producing a serialisation of a 
document without any declarations is flawed, you mean?

Paul



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