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

Shane StClair updated XMLBEANS-501:
-----------------------------------

          Description: 
Due to hardcoding in TextSaver, currently it's impossible to set HTML encoded 
values (e.g. €, ™, etc) using xmlbeans. This is because ampersands 
are detected and replaced with & in various methods in TextSaver 
(entitizeContent, entitizeAttrValue, emitAttrValue, and entitizeAndWriteText).

I believe the intent is to replace naked ampersands with the encoded entity 
(&), however currently entities that are already encoded are not detected, 
so you end up with things like €, 
, etc.

Seems like there are a few options:

1. Confine all character replacement to XmlOptionCharEscapeMap and provide a 
method to initialize without defaults or remove defaults (i.e. remove & -> 
& replacement)
2. Provide an XmlOptions setting to disable ampersand replacement and let the 
user be responsible for preventing invalid content
3. In TextSaver, examine characters following the ampersand to see if the 
ampersand begins an encoded entity.
    Affects Version/s: Version 2.6
              Summary: Can't use encoded HTML entities  (was: Can)
    
> Can't use encoded HTML entities
> -------------------------------
>
>                 Key: XMLBEANS-501
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-501
>             Project: XMLBeans
>          Issue Type: Improvement
>    Affects Versions: Version 2.6
>            Reporter: Shane StClair
>            Priority: Minor
>
> Due to hardcoding in TextSaver, currently it's impossible to set HTML encoded 
> values (e.g. €, ™, etc) using xmlbeans. This is because ampersands 
> are detected and replaced with & in various methods in TextSaver 
> (entitizeContent, entitizeAttrValue, emitAttrValue, and entitizeAndWriteText).
> I believe the intent is to replace naked ampersands with the encoded entity 
> (&), however currently entities that are already encoded are not 
> detected, so you end up with things like €, 
, etc.
> Seems like there are a few options:
> 1. Confine all character replacement to XmlOptionCharEscapeMap and provide a 
> method to initialize without defaults or remove defaults (i.e. remove & -> 
> & replacement)
> 2. Provide an XmlOptions setting to disable ampersand replacement and let the 
> user be responsible for preventing invalid content
> 3. In TextSaver, examine characters following the ampersand to see if the 
> ampersand begins an encoded entity.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: dev-h...@xmlbeans.apache.org

Reply via email to