users@jaxb.java.net

RE: How does JAXB handle enumeration?

From: Geis, Matt <Matt.Geis_at_schwab.com>
Date: Fri, 13 Feb 2004 17:37:05 -0700

One suggestion was to do the following (this is from an email from Kohsuke)

org.apache.xml.serialize.OutputFormat of = new
org.apache.xml.serialize.OutputFormat();
of.setOmitXMLDeclaration(true);
org.apache.xml.serialize.XMLSerializer xs = new
org.apache.xml.serialize.XMLSerializer(new FileOutputStream("abc.xml"), of
);
marshaller.marshal( jaxbObject, xs );

Other serializers would be the GNU XMLWriter (in GNU JAXP), or David
Megginson's XMLWriter (http://www.megginson.com/Software/)/



-----Original Message-----
From: Sam Cheung [mailto:sylcheung_at_hotmail.com]
Sent: Friday, February 13, 2004 4:21 PM
To: users_at_jaxb.dev.java.net
Subject: Re: How does JAXB handle enumeration?


Okay, I will give it a try.
Thanks again.

On a related question, Is there a way to config the Marshaller not to
marshal this line in my output?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

I tried setting Marshaller.JAXB_FORMATTED_OUTPUT to false, but this does not

help.
I work-around this by writing my own DataWriter() (which no-op the
startDocument()). Is there a better way?


Thanks.

>From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
>Reply-To: users_at_jaxb.dev.java.net
>To: users_at_jaxb.dev.java.net
>Subject: Re: How does JAXB handle enumeration?
>Date: Fri, 13 Feb 2004 16:04:54 -0800
>
>
>We do generate the type-safe enums, but it doesn't always do so by
>default. For example, if your enumeration simple type is anonymous, it
>doesn't. But for named simple types with enumerations, you'll get
>type-safe enums.
>
>You can also use customizations to have XJC generate type-safe enums in
>cases where it does't by default. The spec might have some samples.
>
>For starter, try making that simple type a global simple type.
>
>regards,
>--
>Kohsuke Kawaguchi
>Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>

_________________________________________________________________
Get some great ideas here for your sweetheart on Valentine's Day - and
beyond. http://special.msn.com/network/celebrateromance.armx


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net