[xsd-users] How to serialize character reference i.e. 
Jack Reese
jackson.reese at gmail.com
Tue Apr 19 13:15:36 EDT 2011
Please disregard the question below (regarding parsing character constants):
Here's the solution - in my previous experiments to write the character
constant, I had set the *string* to *normalizedString* which was causing the
white space character constants to be stripped during parsing. Switching
the type back to string has resulted in the desired/intended effect and I
can now round-trip the character constants from serialization through
parsing.
Thanks again for the help Boris...
~ jr
On Tue, Apr 19, 2011 at 10:15 AM, Jack Reese <jackson.reese at gmail.com>wrote:
> Excellent - thanks Boris. Substituting "\r" in place of the character
> constant 
 works perfectly for serialization.
>
> However, when I now parse the resulting XML, the character constant 
> seems to be dropped out and I'm just left with the string and no character
> constant.
>
> Is there something else I need to do in order to recover the carriage
> return upon parsing?
>
> Thanks again,
>
> ~ jr
>
>
>
> On Tue, Apr 19, 2011 at 8:36 AM, Boris Kolpackov <boris at codesynthesis.com>wrote:
>
>> Hi Jack,
>>
>> Jack Reese <jackson.reese at gmail.com> writes:
>>
>> > When serializing a string that contains "*foo &#**xD; bar*" the
>> resulting
>> > string in the generated XML is converted to "*foo &#xD; bar*" (the
>> "*
>> > amp;*" is added following the "*&*" - as if the "*&#**xD;*" character
>> > reference was not recognized.
>>
>> You need to use the actual character value in UTF-8 (unless you changed
>> the encoding with --char-encoding) instead of a char reference. The
>> serializer will automatically convert it to a reference if necessary.
>>
>> Boris
>>
>
>
More information about the xsd-users
mailing list