Re: toString() differs from save()

Jacob Danner <[email protected]>
Newsgroups gmane.text.xml.xmlbeans.user
Message-ID <[email protected]>
This is by design, take a peek at the javadoc.
http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlTokenSource.html#xmlText(org.apache.xmlbeans.XmlOptions)
xmlText

String <http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html>
*xmlText*(XmlOptions
<http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlOptions.html>
options)

Just like xmlText() but with options. Options map may be null.

Note that this method does not produce XML with the XML declaration,
including the encoding information. To save the XML declaration with the
XML, see save(OutputStream)<http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlTokenSource.html#save%28java.io.OutputStream%29>or
save(OutputStream,
XmlOptions)<http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlTokenSource.html#save%28java.io.OutputStream,%20org.apache.xmlbeans.XmlOptions%29>.

HTH,
-jacobd

On Fri, Sep 25, 2009 at 1:13 AM, Nick de Graeve <[email protected]>wrote:

> When I save my XMLBean to disk I get a slightly different result from when
> I do a toString() or xmlText().
> The formatting and contents are the same but the file on disk starts with
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> while the string does not.
>
> How can I make sure both are exactly the same?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.