public class Main extends Object
This code will parse the provided "example.xml" file to build a tree of java objects, then cause those objects to print out their values to demonstrate that the input file has been processed correctly.
Unlike the "addressbook" example in the "api" section, this implementation has no parsing rules hard-wired into the code in this class. Instead, the parsing rules are loaded from an external file at runtime. This allows the parsing rules to be modified without compiling the code, and potentially makes it somewhat easier to review the parsing rules.
Note, however, that there is tyically quite a tight coupling between the parsing rules and the purpose of the application which means that it may not be all that common for parsing rules to be altered without the application code also being altered, so only in some cases will this prove of benefit. As with all software, it must be determined whether this feature provides a true benefit in the context of the application it is being applied to.
Usage: java Main xmlrules.xml example.xml
Constructor and Description |
---|
Main() |
Copyright © 2001-2013 The Apache Software Foundation. All Rights Reserved.