[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-user
Subject:    Re: toString() differs from save()
From:       Jacob Danner <jacob.danner () gmail ! com>
Date:       2009-09-29 3:16:43
Message-ID: bb04eb0a0909282016n25628b54j61fa307852a9546 () mail ! gmail ! com
[Download RAW message or body]

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 <nick.degraeve@telenet.be>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: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
> 
> 


[Attachment #3 (text/html)]

This is by design, take a peek at the javadoc.<br><a \
href="http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlTokenSour \
ce.html#xmlText(org.apache.xmlbeans.XmlOptions)">http://xmlbeans.apache.org/docs/2.4.0 \
/reference/org/apache/xmlbeans/XmlTokenSource.html#xmlText(org.apache.xmlbeans.XmlOptions)</a><br>
 <h3>
xmlText</h3>
<pre><a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html" \
title="class or interface in java.lang">String</a> <b>xmlText</b>(<a \
href="http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlOptions.html" \
title="class in org.apache.xmlbeans">XmlOptions</a> options)</pre>

Just like xmlText() but with options.
 Options map may be null.
 <p>
 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 <a href="http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlb \
eans/XmlTokenSource.html#save%28java.io.OutputStream%29"><code>save(OutputStream)</code></a> \
or <a href="http://xmlbeans.apache.org/docs/2.4.0/reference/org/apache/xmlbeans/XmlTok \
enSource.html#save%28java.io.OutputStream,%20org.apache.xmlbeans.XmlOptions%29"><code>save(OutputStream, \
XmlOptions)</code></a>. </p>HTH,<br>-jacobd<br><br><div class="gmail_quote">On Fri, \
Sep 25, 2009 at 1:13 AM, Nick de Graeve <span dir="ltr">&lt;<a \
href="mailto:nick.degraeve@telenet.be">nick.degraeve@telenet.be</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> When I save my XMLBean to disk \
I get a slightly different result from when I do a toString() or xmlText().<br> The \
formatting and contents are the same but the file on disk starts with<br> <br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
<br>
while the string does not.<br>
<br>
How can I make sure both are exactly the same?<br>
<br>
<br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a \
href="mailto:user-unsubscribe@xmlbeans.apache.org">user-unsubscribe@xmlbeans.apache.org</a><br>
 For additional commands, e-mail: <a \
href="mailto:user-help@xmlbeans.apache.org">user-help@xmlbeans.apache.org</a><br> \
<br> </blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic