You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Rickardsson Daniel <da...@wmdata.com> on 2004/11/01 09:13:13 UTC

Save(Writer)?!

Hello!
I have a problem with the metod XmlTokenSource.save(Writer writer)... I use it like this:
 
<!--- some initial code --->
StringWriter sw = new StringWriter();
  try {
    <XmlObject>.save(sw);
    return sw.toString();
  } catch (IOException e) {
    return null;
  }

My object <XmlObject> who I have parsed with an xml-string contains the initial line:
<?xml version="1.0" encoding="UTF-8"?>
 
And when I try to return the xml, the initial line (<?xml version="1.0" encoding="UTF-8"?>) is lost?!
 
But when I use the save metod lika this => save(System.out) it gives me the correct xml!
 
How can those two metods act different?!
 
Please come back to me about this problem, or if you have any other way to solve the (getXml-problem)...
 
Thanks Daniel.