You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Wing Yew Poon (JIRA)" <xm...@xml.apache.org> on 2009/11/20 02:18:39 UTC

[jira] Resolved: (XMLBEANS-298) Saver.entitizeAttrValue() doesn't honor SAVE_SUBSTITUTE_CHARACTERS setting

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

Wing Yew Poon resolved XMLBEANS-298.
------------------------------------

       Resolution: Fixed
    Fix Version/s: Version 2.4.1 

The fix will go into the next release (expected to be 2.5).
The character escaping now applies to attributes as well. Namespace declarations are not escaped.

> Saver.entitizeAttrValue() doesn't honor SAVE_SUBSTITUTE_CHARACTERS setting
> --------------------------------------------------------------------------
>
>                 Key: XMLBEANS-298
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-298
>             Project: XMLBeans
>          Issue Type: Bug
>    Affects Versions: Version 2.2
>            Reporter: Niklas Mehner
>            Assignee: Wing Yew Poon
>             Fix For: Version 2.4.1 
>
>
> I'm formatting a XML Document using the following XMLOptions:
>       XmlOptions options = new XmlOptions();
>       options.setSavePrettyPrint();
>       XmlOptionCharEscapeMap escapes = new XmlOptionCharEscapeMap();
>       escapes.addMapping('<', XmlOptionCharEscapeMap.PREDEF_ENTITY);
>       escapes.addMapping('>', XmlOptionCharEscapeMap.PREDEF_ENTITY);
>       escapes.addMapping('&', XmlOptionCharEscapeMap.PREDEF_ENTITY);
>       escapes.addMapping('\'', XmlOptionCharEscapeMap.PREDEF_ENTITY);
>       escapes.addMapping('"', XmlOptionCharEscapeMap.PREDEF_ENTITY);
>       options.setSaveSubstituteCharacters(escapes);
> This works when using content containing the escaped chars, but attribut values are not escaped:
> <inventory>
>     <customer name1=">"/>
> </inventory>
> This should be:
> <inventory>
>     <customer name1="&gt;"/>
> </inventory>
> The reason for this is, that Saver.entitizeAttrValue() does not contain:
> [....]
> else if (isEscapedChar( ch ))
>                         i = replace( i, _replaceChar.getEscapedString( ch ) );
> [....]
> This is only done in Saver.entitizeContent().

-- 
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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org