Hi Joshua,

i use the same way to marshaling the java classes to string but in my
case it's work.

You are light on information about how you unmarshal your XML into
java classes. My experiences with Castor told me in the most cases if
the marshaling result is wrong it has its root in the way you
unmarshal your XML. I use mapping files which define the attributes or
elements and it works great.

Greeting
Thomas

On Tue, Oct 21, 2008 at 3:49 PM, joshua1970 <[EMAIL PROTECTED]> wrote:
>
> Dear all,
> I have looked at many examples about Marshalling but all examples do a
> Marshalling
> on a FileWriter stream. Is it possible to Marshal an XML directly to a
> String ?
> P.s. I have tried also with :
>
> StringWriter st = new StringWriter();
> marshaller.marshal(object , st);
>
> String xml = st.toString();
>
> but then a strange thing happens....my attribute are turned into nodes!
> f.e. instead of this:
>
> <node1 id="10" session="20">
>
> I get as result:
>
> <node1>
>  <id>10</id>
>  <session>20</session>
> </node1>
>
> Any help !
> joshua
> --
> View this message in context: 
> http://www.nabble.com/How-to-Marshal-XML-to-a-String---tp20090707p20090707.html
> Sent from the Castor - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to