Re: Namespace Fixup Proposal

On 9/6/07, Henry S. Thompson <ht@inf.ed.ac.uk> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Norman Walsh writes:
>
> > HST wrote:
>
> > | Yes, but it still won't necessarily serialise without work, and it's
> > | possible that serialising will introduce failure to round-trip.
> > | Suppose the matrix has an ns-attribute for the default namespace, but
> > | the included bit consists entirely of no-namespace elts.  The
> > | serialised result will be borked.  To detect this, you have to look at
> > | every node in the inserted tree.
> >
> > I suppose the default namespace *is* a special case. But I don't think
> > that's a problem.
> >
> > Here's a document:
> >
> >   <rootelem xmlns="rootns">
> >     <div xmlns="xhtml">
> >       <target/>
> >     </div>
> >   </rootelem>
> >
> > Suppose I want to replace target with some subtree. When do I ever have
> > to look at the subtree's descendants?
> >
> > To insert
> >
> >   <x:otherroot xmlns:x="xxxns">
> >     <nons/>
> >   </x:otherroot>
> >
> > I simply make sure that if there's a default namespace where 'target'
> > appears, I undeclare it. Everything else "just works". No?
>
> Yes.
>
> Now consider this case:
>
> <p:rename match="my:foo" new-name="foo" xmlns:my="http://www.example.com/ns"/>
>
> when the imput is
>
>  <foo xmlns="http://www.example.com/ns">
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>   <baz>...</baz>
>  </foo>

I believe rename, wrap, and unwrap the only step with this problem.

We could fix this by requiring a unique namespace declaration to be
generated for rename and wrap.

An unwrap whose target element has namespace declarations would need
to add those same declaration to each child element.

So, the pain is limited.


-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Thursday, 6 September 2007 14:43:52 UTC