XmlPullParser / XStream breaks on Entity Tag Android

229 views Asked by At

I am using XStream in Android with the built-in XMLPullParser. Everything works great except for my entity tag. If I have the start of my file like this

<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/css" href="big_chart_xml.css" ?><!DOCTYPE outer[ <!ENTITY copy "&#169;"> ]>

<vault> ...

It'll break, with an error saying

com.thoughtworks.xstream.io.StreamException:  : Unexpected token (position:TEXT @3:1 in java.io.StringReader@422749b8)

If I make the entity tag multi-line, it gives the same error, always pointing to the start of the first element. If I remove the entity tag from inside doctype it works fine, so its something about the nested tags.

1

There are 1 answers

0
Benusko On

Have you try with something like this ?

StringBuilder xml = new StringBuilder();
xml.append("<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/css"       href="big_chart_xml.css" ?><!DOCTYPE outer[ <!ENTITY copy "&#169;"> ]>").append("\n")