Re: Serializing CAS into XMI using UTF-8

2020-01-07 Thread Marshall Schor
not sure, but I think we don't have any code that handles utf-16 encoding when
reading an external xmi cas.

-Marshall

On 1/7/2020 3:30 AM, Rune Stilling wrote:
> Hi list
>
> I’ve run into a problem with serializing a cas in UTF-16 encoding. I use the 
> following code:
>> XMLSerializer xmlSerializer = new XMLSerializer(pw);
>> xmlSerializer.setOutputProperty(OutputKeys.ENCODING, "UTF-16");
>> XmiCasSerializer xmiCasSerializer = new 
>> XmiCasSerializer(cas.getTypeSystem());
>> xmiCasSerializer.serialize(cas.getCas(), xmlSerializer.getContentHandler());
> When I try to deserialize this code with the CasIOUtils.load(…) method I get 
> an exception:
>> [Fatal Error] :1:40: Content is not allowed in prolog.
>
> If I set the encoding to UTF-8 there’s no issue.
>
> Best,
> Rune


Serializing CAS into XMI using UTF-8

2020-01-07 Thread Rune Stilling
Hi list

I’ve run into a problem with serializing a cas in UTF-16 encoding. I use the 
following code:
> XMLSerializer xmlSerializer = new XMLSerializer(pw);
> xmlSerializer.setOutputProperty(OutputKeys.ENCODING, "UTF-16");
> XmiCasSerializer xmiCasSerializer = new XmiCasSerializer(cas.getTypeSystem());
> xmiCasSerializer.serialize(cas.getCas(), xmlSerializer.getContentHandler());
When I try to deserialize this code with the CasIOUtils.load(…) method I get an 
exception:
> [Fatal Error] :1:40: Content is not allowed in prolog.


If I set the encoding to UTF-8 there’s no issue.

Best,
Rune