Hi,
I have a really big problem, I'm constructing an xml from Java Mapped
Classes
and no information about namespace is written to the output, so the result
is
not a well-written XML just some nicely formatted string :-).
I'm using jvm 1.6.0_05 with whatever JAXB version it has.
I have my Mapped Classes in a jar file, each package has his own
package-info.java with the XmlSchema tag defined, NO ObjectFactory.
Basically my application does something like:
------------------------------------------------------------------------------------------------------
Code Snippet
------------------------------------------------------------------------------------------------------
package test.xml;
import biz.Policy; // mapped classes with their own namespace in
package-info.java
public class Execute {
public void writeXml(Policy pol) throws Exception {
JAXBContext ctx=JAXBContext.newInstance(Envelope.class);
Envelope envelope=new Envelope();
envelope.policy = pol;
Marshaller mm = ctx.createMarshaller();
mm.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
mm.marshall(envelope, {output});
}
@XmlRootElement(namespace="
http://www.xxx.org/xsd/test-cases")
public static class Envelope {
@XmlElement
@XmlElementWrapper(name="list")
public Policy policy;
}
}
------------------------------------------------------------------------------------------------------
Resulting xml (sorry for the [])
------------------------------------------------------------------------------------------------------
[ns2:envelope xmlns:ns2="
http://www.xxx.org/xsd/test-cases"]
[list] [!-- no namespace prefix here !!!!! --]
[policy] [!-- no namespace !!!!! --]
........policy data...........
[/policy]
[/list]
[/ns2:envelope]
If I generate the schemas for my envelope class, all things
seems well written, so I'm a bit lost of what is happening.
Some clue of what I'm missing that makes JAXB
miss the policy and list namespace in my resulting XML ?
Thanks in advance
tonio
--
View this message in context: http://www.nabble.com/Marshaller-not-writing-namespace-information-tp18833052p18833052.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.