W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2000

Re: Namespace treatment, cloning and node.supports

From: james anderson <james.anderson@mecomnet.de>
Date: Fri, 03 Mar 2000 11:40:33 +0100
Message-ID: <38BF96A0.B452253C@mecomnet.de>
To: "www-dom@w3.org" <www-dom@w3.org>


Arnaud Le Hors wrote:
> 
> "Dieter Köhler" wrote:
> > ...
> > it is a real advantage not to have to bother with syntactic
> > malformed DOM trees.  In an OO view:  If I write a component for doing

?.
The correct place for serialization is in the serializing equivalent of
the parser. Why should one ever be writing such components? And, if so,
the complaint should not be, that the serialization is tricky, but
instead, that the parser is not providing the namespace utilities needed
for trivial serialization. As far as i understand SAX2, for example, it
offers everything which a parser would need to make the necessary state
available to an application.

> > something with a DOM tree, e.g. outputting it as an XML document as
> > mentioned above, with the present version of DOM2 my component cannot
> > rely on getting wellformed elements -- and this is a real big
> > disadvantage.
> 
> The only disadvantage is that it pushes the burden of fixing namespace
> prefixes to whoever wants to serialize the document. In an OO view, this
> would only be done in one place though. And, since the DOM doesn't fix
> namespace declarations, the serializer has to do some fixup anyway.

More than that, since the parser has to retain such information anyway,
there's no reason to duplicate it anywhere else. It need only manage a
unique NCName-conformant tag for each namespace and (modulo presence of
a default binding) prefixes all tags. As such, it's not "fixing up",
it's literal serialization. While the prefixes present present from
parsing do reflect the state while parsing, they can't be taken
seriously when serializing.

> Fixing up prefixes at the same time isn't much of an additional burden.
> As opposed to have every possible module/object bother with figuring out
> unique prefixes...

? Or could it be that the DOM constrains one to always manage consistent
namespace nodes simultaneous with tree mutations? please tell me it
isn't so.

...
Received on Friday, 3 March 2000 05:34:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT