Click anywhere to close

XmlParser for Android

XmlParser is an XmlParser that utilizes XmlPullParser to read in a generic Xml stream and create a composite XmlObject. This object contains all of the data that was in the xml file. The intention of this library is to simplify any code that used to have to write a bunch of boiler plate code in order to interact with XmlPullParser. Below are some usage examples of XmlParser.

Sample Xml File:
<array>
    <item>First Item</item>
    <anotheritem>Second Item</anotheritem>
</array>

Java code snippet:
InputStream is = getContext().getResources().openRawFile( R.raw.simple_xml )
XmlParser parser = new XmlParser( is, null );
try {
    XmlObject obj = parser.getXmlObject();
    Log.v( "Xml Parser", "Array with name: " + child.getTagName() );
    for( XmlObject child : obj.getChildren() ) {
        Log.v( "Xml Parser", "Child Tag Name: " + child.getTagName() +
                                     " Value: " + child.getValue() );
    }
} catch ( XmlParserException e ) {
    e.printStackTrace(); // Something went wrong.  Xml is formated incorrectly
}

Expected logcat output:
Array with name: array
Child Tag Name: item Value: First Item
Child Tag Name: anotheritem Value: Second Item


Recent Posts

Retro on Colab Using Google Colab to run OpenAI's Gym Retro
Categories:  AI/ML, Colab, Retro
Posted: May 25, 2018
Running Multiple Retro Environments Using retrowrapper to easily run environments as subprocesses
Categories:  AI/ML, Retro
Posted: May 22, 2018
Google Colab + Losswise Using Losswise as a replacement for Tensorboard on Colab
Categories:  AI/ML, Colab
Posted: May 21, 2018
OpenAI Retro - Collision Maps Detecting collision maps from sonic frames using a U-Net
Categories:  Projects, AI/ML
Posted: May 20, 2018
Walmart.com - Fake "AirPods" I just can't believe that Walmart is allowing these on the marketplace
Categories:  Random
Posted: May 19, 2018