Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top