Well, after reading this:
<quote>
The harder but faster way is
1. Pick up a free XMLWriter. Search the list archive for information
about various XMLWriters that I and other people recommended.
2. modify it so that it recognizes the "mysection" element and print
its contents in CDATA.
</quote>
from:
https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=641
I tried it but it does not seem to work.
I do the following:
final StringWriter writer = new StringWriter();
try {
final XMLSerializer ser = new XMLSerializer();
final OutputFormat of = new OutputFormat("XML", "UTF-8", true);
of.setPreserveSpace(true);
of.setCDataElements(new String[]{"Message_Text"});
of.setStandalone(true);
of.setLineWidth(80);
of.setPreserveEmptyAttributes(false);
ser.setOutputFormat(of);
marshaller.marshal(toMarshal, ser);
return writer.toString();
} finally {
writer.flush();
}
Some of the attributes on the OutputFormat are recognised, however most are
agnored..
especially the of.setCDataElements(new String[]{"Message_Text"});
It seems to only work when I marshalise the JAXB Object to a a document
first, and then to the
XMLWriter. Has anyone managed to skip writing to the document and instead
marshal to the writer set on the serialiser?
Cheers,
nick
-----Ursprungliche Nachricht-----
Von: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Gesendet: Freitag, 13. Februar 2004 18:24
An: users_at_jaxb.dev.java.net
Betreff: Re: Issue 6 Exception when Unmarshalling an element with int or
double list as a value
Just FYI, the bug is fixed. It will be available next Monday.
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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net