JaspXML uploaded to Github


The first small step in cleaning up my simulator is complete. The result is the JaspXML parser. A simple XML parser/iterator for Java, designed for reading data from large XML files without the memory cost of a DOM parser, or the complexity of a SAX/StAX parser.

It is based on code I wrote for a project during a university course several years back. I needed a way of reading data from XML files, and since I did not know how large these data files would be I used a StAX parser. But StAX parsers are a pain to work with so I hid it behind a more DOM like interface to make it easier to use. It was ugly, but it worked. I later reused and improved the parser during my master’s thesis, when I once again needed a simple way of parsing very large XML files.

JaspXML is based on that final version. I completely rewrote, reorganized, documented, and tested it. What was left is a small and simple XML iterator that can step through an XML document using three commands; next(), down() and up().

next()

Steps forward one step and returns the next element at the current depth of the XML document.

down()

Steps down to the children of the current element.

up()

Steps back up to the parent of the current element.

An example application is provided that uses JaspXML to parse an XML document and prints out the contents of each element.

Leave a comment

Your email address will not be published. Required fields are marked *