users@jaxb.java.net

Re: [ANN] Namespace prefix remapper

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 06 Mar 2003 13:46:05 -0800

> >The code contains some severe limitations, such as it might break global
> >attribute names or it cannot handle QNames in values, but still I hope
> >it will solve a large portion of problems that we've heard so far
> >regarding this issue.
>
> What do you mean?

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.

- Suppose the original output was

    <ns1:root xmlns:ns1="uri1"> ns1:someQName </ns1:root>

  Mapping uri1 to "" will change this to

    <root xmlns="uri1"> ns1:someQName </root>

  But this is wrong.



> 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.


> 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.

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.


> When are we looking at the next release? I notice it is listed as Final currently on the JCP.

I'm sorry, I don't know.



regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com