Back to project page Dumbledroid.
The source code is released under:
Copyright (c) 2013, Leocadio Tin? All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project Dumbledroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.leocad.dumbledroid.data.xml; /*from w w w . j av a 2 s.com*/ import java.io.IOException; import java.io.InputStream; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; public class SaxParser { static { System.setProperty("org.xml.sax.driver", "org.xmlpull.v1.sax2.Driver"); } public static Node parse(InputStream rawXML, String encoding) throws SAXException, IOException { XMLReader reader = XMLReaderFactory.createXMLReader(); SaxHandler handler = new SaxHandler(); reader.setContentHandler(handler); reader.setErrorHandler(handler); InputSource source = new InputSource(rawXML); source.setEncoding(encoding.toString()); reader.parse(source); return handler.getRoot(); } }