Thursday, 5 September 2013

Sax parser with string input

Sax parser with string input

I'm trying to parse an xml file with SaxParser. I've done this with an url
and with an xml file. But now i want to parse it from an string.
This is the string:
String xml_string = "<?xml version="1.0" standalone="yes"?> <NewDataSet>
<Table> <expnr>672 </expnr> <artnr>ML-824 </artnr> </Table>
<Table> <expnr>672 </expnr> <artnr>ML-824 </artnr> </Table>
</NewDataSet> "
And now i need to parse that string, i tried this:
InputStream stream = new ByteArrayInputStream(resultFull.getBytes());
items = SAXXMLParser.parse(stream);
but its not working (got error in the arrayadapter)
What is the right way to parse this?

No comments:

Post a Comment