[ 
https://issues.apache.org/jira/browse/XMLBEANS-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark van Holsteijn updated XMLBEANS-357:
----------------------------------------

    Attachment: Saver.java
                Saver.java~

The following change to the method entitizeAttrValue() in the class Saver  
preserves the whitespace on output and implements the escaped characters for 
attribute values too.

bash-3.2$ diff Saver.java Saver.java~
1366,1372c1366
<                 else if (ch == '\n')
<                     i = replace( i, "&#10;" );
<                 else if (ch == '\r')
<                     i = replace( i, "&#13;" );
<                 else if (isEscapedChar( ch ))
<                         i = replace( i, _replaceChar.getEscapedString( ch ) );

<               else
---
>                 else

> XMLBeans does not escape whitespace characters in attribute values on output
> ----------------------------------------------------------------------------
>
>                 Key: XMLBEANS-357
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-357
>             Project: XMLBeans
>          Issue Type: Bug
>          Components: XmlObject
>    Affects Versions:  Version 2.3
>            Reporter: Mark van Holsteijn
>         Attachments: Saver.java, Saver.java~
>
>
> When XMLBeans parses an XML attribute that contains newline character 
> entities, it does preserve them but when the attribute value is sent to 
> output the entity is not preserve causing lose of information. 
> An example:
> <document>
>     <property  name="properties" value="
> line 1&#xA;
> line 2&#xA;
> line 3&#xA;
> "/>
> </document>
> is outputted as
> <document>
>     <property  name="properties" value="
> line 1
> line 2
> line 3
> "/>
> </document>
> When this document  is parsed again, the newlines in the attribute are lost 
> (!)
> Adding the newline character to the saveSubstituteCharacters option using an 
> XmlOptionsCharEscapeMap does not help for attribute values, only for elements.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to