XMLPullParser Special Characters

swsecurity

New Member
I use XMLPullParser to parse an XML document which unfortunately contains some special chars like:
or &amp... It seems that these chars interrupt the parsing procedure and only the text after these chars is shown but not before (if the special char appears in the middle of some text content). I have no control over this XML file so i have to fix this issues while parsing the document.How can I do this? I already did some research and it showed up that I am able to implement an eventType called ENTITY_REF but I don't know how to deal with that approach.Would be glad for some hints.My Parser:\[code\] while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_TAG) { currentTag = xpp.getName(); } else if (eventType == XmlPullParser.TEXT) { if ("title".equals(currentTag)) { currentEvent.setTitle(xpp.getText()); System.out.println("Event title: " + xpp.getText()); } } else if (eventType == XmlPullParser.END_TAG) { if ("event".equals(xpp.getName())) { events.add(currentEvent); currentEvent = new Event(); } } else if (eventType == XmlPullParser.ENTITY_REF) { System.out.println("Entity REF: " + xpp.getText()); } eventType = xpp.nextToken(); }\[/code\]
 
Back
Top