[REBOL] Re: object2XML
From: bry:itnisk at: 10-Mar-2004 11:19
> What do you wish to do with namespaces?
They aren't at all as
> straightforward as they seem. They get
inherited, and the namespace
> prefixes can be reused within the nesting
of the document all the while
> resolving to totally different namespace
>URIs.
I believe this is what Joe English called
psychotic namespacing.
i've seen a lot of fucked up xml in my time,
it's actually quite rare to see:
<tag xmlns="http://tag.com"
xmlns:t="http://tag.com">
<t:tag>
<p>hi</p>
<t:tag xmlns:t="http://nottag.com">
<t:p>hi</t:p>
</t:tag>
</t:tag>
</tag>
but it is of course possible, my perspective
is to penalize that kind of structure, to
optimize for more common structures and hell
if it turns out in the middle of analyzing a
structure that it is this kind of mess, to
restart, so it takes longer, too bad.
Also from a namespace point of view the
prefix is absolutely meaningless, so one
could in fact process the above with a
namespace function that if it encountered a
prefix the same as one it has encountered
before but bound to a different namespace
then all it has to do is to autogenerate a
prefix, change the value in the block to
that prefix, and move on.
> The namespace processing,
> if it has a chance, should be put into the
parser itself and not in
> xml-to-object or in some higher level
processing. Adding in a namespace
> aware SAX2-style handler into parse-xml is
IMHO the only workable way to
> go.
Well I don't agree. for reasons given in
other post and this one.