I'm trying to parse an xml document using the xml pull parser. Everything worked fine until i started dealing with an xml document containing an xxml declartation:
When the declaration is there i get the following error:
02-08 15:37:16.960: WARN/System.err(9721): org.xmlpull.v1.XmlPullParserException: PI must not start with xml (position:unknown @1:5 in java.io.InputStreamReader@47ec2770)
If I take out the declaration from the document, everything works. It's too late for me to switch to another parser so i need to make it work!
Here's what my parser code looks like
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(false);
// factory.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
XmlPullParser xpp = factory.newPullParser();
// get a reference to the file.
File file = new File(Environment.getExternalStorageDirectory() + "/"
+ Constants.SD_CARD_DIR + "/" + Constants.XMLPATH);
// create an input stream to be read by the stream reader.
FileInputStream fis = new FileInputStream(file);
// set the input for the parser using an InputStreamReader
xpp.setInput(new InputStreamReader(fis));
int eventType = xpp.getEventType();
// /
while (eventType != XmlPullParser.END_DOCUMENT) {...}