|
ElementEngine: Java XML
Parser, SVG Player A small footprint XML parser with source. A Scalable Vector Graphics (SVG) Player that uses the parser. XML Parser: The following listing creates a new Parser called test from a file called “test.xml.” Calling getElements creates an enumeration. Each element is checked to see if it is a Title element. If it is, the title is printed with a call to getValue. If the Author element is encountered, a check is made for the wife attribute with a call to hasAttribute. If hasAttribute is true, then the wife attribute data is printed with a call to getAttribute. Parser
test = new
Parser("test.xml");
Download:
testelement.jar (5kb)
Download:
testsvg.jar (17kb) Several things become apparent when using Xerces or
other full-featured parsers. There is a large amount of overhead in size and
memory. There is a significant learning curve required to perform basic
tasks. A stripped down parser may be appropriate to decrease
overhead in a small program. It may be appropriate for "closed" XML
systems. In closed system, XML created by one program is parsed and
handled by another. In that case, the parser does not need to handle every
possible scenario. It needs to handle all possible output from program that is
creating the XML. There may be cases where an application specific parser
may be the best choice. |