You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by BL...@decaresystems.ie on 2004/02/20 11:20:30 UTC

Charactor encoding

Hi,
   I see that when I use xmlText on an XmlObject with string content I get 
the 'difficult' characters translated into character code. For example, 
'<' gets translated into '&lt;'. I'd like this translation process to be 
wider. For example I'd like to have the Copyright symbol rendered as 
&copy; (in line with iso8859-1).

I've tried setting the characterEncoding in xmlOptions to " iso8859-1" but 
that has had no effect - in fact I can set that value to nonsense and I 
get no change.

Is xmlBeans capable of the kind of translations I'm trying to achieve?

Thanks in advance for any help,

Brendan

Re: Charactor encoding

Posted by Toby H Ferguson <to...@Sun.COM>.
Brendan,

without looking into the details I suspect that the answer is going to 
be "no" - what you've called "difficult" characters are actually defined 
in the XML spec, Appendix B.4.3 "Predefined XML Character References". 
Here 5 characters references are predefined as part of  XML itself 
(quot, amp, apos, lt, gt) and this is what I suspect xmlbeans spits out 
- the reason for using these characters references rather than the 
characters themselves is to enable the characters to appear in places 
like attributes, entities and the like.

What you might like to do is to write an XSLT transform that would do 
the job, and simply write the text to that transform.

Toby

BLawlor_Contractor@decaresystems.ie wrote:

>
> Hi,
>    I see that when I use xmlText on an XmlObject with string content I 
> get the 'difficult' characters translated into character code. For 
> example, '<' gets translated into '&lt;'. I'd like this translation 
> process to be wider. For example I'd like to have the Copyright symbol 
> rendered as &copy; (in line with iso8859-1).
>
> I've tried setting the characterEncoding in xmlOptions to " iso8859-1" 
> but that has had no effect - in fact I can set that value to nonsense 
> and I get no change.
>
> Is xmlBeans capable of the kind of translations I'm trying to achieve?
>
> Thanks in advance for any help,
>
> Brendan 


Re: Charactor encoding

Posted by Toby H Ferguson <to...@Sun.COM>.
Brendan,

without looking into the details I suspect that the answer is going to 
be "no" - what you've called "difficult" characters are actually defined 
in the XML spec, Appendix B.4.3 "Predefined XML Character References". 
Here 5 characters references are predefined as part of  XML itself 
(quot, amp, apos, lt, gt) and this is what I suspect xmlbeans spits out 
- the reason for using these characters references rather than the 
characters themselves is to enable the characters to appear in places 
like attributes, entities and the like.

What you might like to do is to write an XSLT transform that would do 
the job, and simply write the text to that transform.

Toby

BLawlor_Contractor@decaresystems.ie wrote:

>
> Hi,
>    I see that when I use xmlText on an XmlObject with string content I 
> get the 'difficult' characters translated into character code. For 
> example, '<' gets translated into '&lt;'. I'd like this translation 
> process to be wider. For example I'd like to have the Copyright symbol 
> rendered as &copy; (in line with iso8859-1).
>
> I've tried setting the characterEncoding in xmlOptions to " iso8859-1" 
> but that has had no effect - in fact I can set that value to nonsense 
> and I get no change.
>
> Is xmlBeans capable of the kind of translations I'm trying to achieve?
>
> Thanks in advance for any help,
>
> Brendan