For mine, which works, I do:
try{
m.setProperty("com.sun.xml.bind.namespacePrefixMapper", new
NSPrefixMapper());
}catch(Exception e){
// if the JAXB provider doesn't recognize the prefix mapper,
// it will throw this exception. Since being unable to
specify
// a human friendly prefix is not really a fatal problem,
// you can just continue marshalling without failing
}
m.setProperty(m.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.setProperty(m.JAXB_SCHEMA_LOCATION, namespaceURI + " " +
xsdName);
________________________________
From: bmadhuri [mailto:bmadhuri_at_myway.com]
Sent: Friday, September 26, 2003 9:16 AM
To: users_at_jaxb.dev.java.net
I am creating the root normally. And then, before marshalling I am using
PrefixMapped(This is from Kohsuke's work around to remove namespace
prefix). Could this be causing problem? Here is my marshalling method.
Thanks,
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,
"schemalocation/myschema.xsd
<
http://www.xmRadio.com/Schemas/DataTransmission> ");
DataWriter writer = new DataWriter(
new OutputStreamWriter(new FileOutputStream(fileName),"UTF-8"),
"UTF-8" );
// create prefix mapper, and set prefixes.
PrefixMapper pm = new PrefixMapper(writer);
pm.setPrefix("mynamespace",""); // put namespace foo without a prefix
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
m.marshal(root, pm);
}catch( ValidationException ue ) {
logger.error( "Caught ValidationException"+ue );
} catch( JAXBException je ) {
je.printStackTrace();
} catch( IOException ioe ) {
ioe.printStackTrace();
}
--- On Fri 09/26, Ryan Shoemaker - JavaSoft East <
Ryan.Shoemaker_at_Sun.COM > wrote:
From: Ryan Shoemaker - JavaSoft East [mailto: Ryan.Shoemaker_at_Sun.COM]
To: users_at_jaxb.dev.java.net
Date: Fri, 26 Sep 2003 10:06:49 -0400
Subject: Re: Formatted XML Content
bmadhuri wrote:
>
> Thanks, Ryan!
> I am using version 1.0.1. But still could not get the indentation.
If possible, send me a sample app that reproduces the problem and
I'll look into it some more.
Thanks,
--Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
________________________________
No banners. No pop-ups. No kidding.
Introducing My Way -
http://www.myway.com