users@jaxb.java.net

Re: [ANN] Namespace prefix remapper

From: Malachi de AElfweald <malachi_at_EOTI.ORG>
Date: Thu, 06 Mar 2003 18:05:59 -0700

On Thu, 6 Mar 2003 13:46:05 -0800, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM> wrote:
>There are two cases that I'm aware of where this PrefixMapper breaks.
>
>- Suppose the original output was
>
> <ns1:root ns1:att="foo" xmlns:ns1="uri1"> bar </ns1:root>
>
> Mapping uri1 to "" will change it to
>
> <root att="foo" xmlns="uri1"> bar </root>
>
> But this is wrong.

I don't see what is wrong with that one.

>> It looks good. A couple questions on it...
>> Shouldn't the xmlns:b be on the root tag, then the b tag just be:
>> <b:bar1></b:bar1> since it is defined as a global mapping, not specific to that node?
>
>I understand this is desirable sometimes, but just FYI what it generates
>right now is also a valid wellformed XML.

Yes, I know it is valid. Currently, we are passing an 800k XML documents over the network (representing entire file structures)... That is with the empty tags fixed... gets much larger this way... just trying to reduce excess code.

>> Also, I see you use the DataWriter, which seems to do a pretty good job...
>> Why is it not in the Javadocs? Is there a way to tell it to collapse
>> empty elements (ie: <b:bar1/>)?
>
>DataWriter is a public domain software written by David Megginson.
>Search "XMLWriter David Megginson" with Google and you'll find the
>source code.

Oh, I didn't realize that the DataWriter was the same one that came with XMLWriter. I downloaded that one earlier today.

>You might be able to modify it to do the smart empty element handling.
>Or you can pick any other XML writer implementation that exists today.

I'll take a look at that as soon as I have a few.

Thanks,
Malachi