views:

126

answers:

1

Hi ,

I am using xStream for serializing and de-serializing objects. But when there is "&" present for any of the tag values , xStream is failing and throwing excpetion.

for e.g. this fails..

<tag>value & value</tag>
Exception :- "An entity name must immediately follow..."

<tag>value value</tag>
this passes

Is there any way to tell xStream to ignore certain characters

Thanks! Pratik

+1  A: 

That's badly formed XML and any XML Parser (not just XStream) should fail that. The & should have been translated to &amp; on encoding (writing) the document.

I would identify what's writing that document and fix the character encoding, then any reading process should work ok.

Brian Agnew