users@jaxb.java.net

Re: XML tag name changes after marshalling

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 10 Jan 2007 09:27:23 -0800

Frank Kumro wrote:
> I currently have two files, one file being an xml document, the other being
> a digital signature of the first document. They are both unmarshalled and
> then the signature is placed into the first xml documents object. I then
> marshal the first xml file (and validate it against the schema) but then the
> xml tag names all change. Why is this?
>
> Example of changes:
>
> Original
> <saml:Issuer ...
>
> After marshalling
> <ns1:Issuer ....

In general, preserving the prefixes (and more importantly preserving the
  all namespace declarations intact) across round-tripping is not
possible. This is because there's no place to keep those values in the
beans.

You'd most likely need to use well-formed XML API that doesn't lose
those things until you verify the signature. Once that's done and when
it comes time for you to start processing the message, JAXB can work nicely.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com