Hi Artem,
Are these files supposed to be the same? This does seem quite odd as
result2.xml isn't even valid xml.
Will you file an issue in Jira and attach any test sources, etc to help with
repro, it doesn't need to be exact and we will certainly try to do our best
to repro with more information. Also, please include some info about the
kind of environment this code was running in.
Thanks,
-jacobd

On Fri, Oct 2, 2009 at 8:09 PM, Artem Portnoy
<artem.portnoy....@gmail.com>wrote:

> There appears to be some kind of problem with passing the
> XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(4) option to the
> Document’s save function. It produces a corrupt output with certain data.
> See attached documents result1.xml and result2.xml.
>
> result1.xml was produced by code like this
>
>     FileOutputStream result1 = *new* FileOutputStream(
> "c:\\temp\\result1.xml");
>
>     resDoc.save(result1);
>
> result2.xml was produced by
>
>     FileOutputStream result2 = *new* FileOutputStream(
> "c:\\temp\\result2.xml");
>
>     resDoc.save(result2, 
> *new*XmlOptions().setSavePrettyPrint().setSavePrettyPrintIndent(4));
>
> Problem is the behavior seems to be highly dependent on data and is kind of
> hard to reproduce, so I’m not sure how to create a bug report for it.
>
> Artem
>
> On Fri, Oct 2, 2009 at 5:21 PM, Wing Yew Poon <wing.yew.p...@oracle.com>wrote:
>
>>  Jacob is correct. Only the '<' needs to be escaped, not the '>'.
>> XML predefines exactly 5 entity references:
>> &lt;
>> &amp;
>> &gt;
>> &quot;
>> &apos;
>> but only &lt; and &amp; must be used instead of the literal characters in
>> element content; the others are optional, with the exception that the
>> 3-character sequence "]]>" cannot appear in character data and must be
>> written as "]]&gt;".
>> - Wing Yew
>>
>>  ------------------------------
>> *From:* Jacob Danner [mailto:jacob.dan...@gmail.com]
>> *Sent:* Friday, October 02, 2009 1:55 PM
>> *To:* user@xmlbeans.apache.org
>> *Subject:* Re: Invalid escaping of XML
>>
>> Off the top of my head I think this is as expected. The > does not need to
>> be escaped only < .
>> -jacobd
>>
>> On Fri, Oct 2, 2009 at 1:17 PM, Artem Portnoy <
>> artem.portnoy....@gmail.com> wrote:
>>
>>>  Hello,
>>>
>>>
>>>
>>> We have an XmlBean that takes in a String. The problem is that if we pass
>>> in an XML String, the XML characters are not properly escaped.
>>>
>>>
>>>
>>> Here’s a simple program I use to test…
>>>
>>>
>>>
>>>   *public* *static* *void* main(String[] args) {
>>>
>>>     Trace trace = TestProcessFlowV2Res.Traces.Trace.Factory.*newInstance
>>> *();
>>>
>>>     trace.setStringValue("<test>");
>>>
>>>     System.*out*.println(trace);
>>>
>>>   }
>>>
>>>
>>>
>>> The output produced looks as follows…
>>>
>>>
>>>
>>> <xml-fragment>&lt;test></xml-fragment>
>>>
>>>
>>>
>>> For some reason the ‘>’ character is not getting escaped. We are
>>> currently using XmlBeans 2.1.0. I’ve tried searching for similar bug reports
>>> on the mailing list archive and couldn’t find anything. If anybody could
>>> shed some light on this issue it would be greatly appreciated.
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Artem Portnoy
>>>
>>> Information Builders, Inc
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
> For additional commands, e-mail: user-h...@xmlbeans.apache.org
>

Reply via email to