Description
xml2class provides you with a simple XML parser, which instantiates data structures written in Java following a XML description (and supports storing them again as XML code). It is thought as an aid for programmers, as it won't do all the work for you.
With the support of xml2class you may describe most data structures' data (such as linked lists, binary trees, tables, menu structures, and so on) in easy to modify XML. Following the XML description, it won't be difficult to write the corresponding Java classes. If you've got those classes, the XML2ClassParser
will do the reading in and the instantiating of the entire structure - with the given values.
Download
xml2class version 05/08/01 | |
Complete package | xml2class.jar (43 KB) |
Class files only | xml2classC.jar (14 KB) |
Source files only | xml2classS.jar (30 KB) |
Package as zip file | xml2class.zip (42 KB) |
API documentation as zip file | x2cAPI.zip (48 KB) |
License
This package is distributed under the GNU General Public License from gnu.org. A copy of the GPL is included in all of the above archives (except xml2classC.jar), but can also be read online (18 KB) at this site.
Documentation
The whole xml2class API documentation is available online. Additionally there are an introduction to xml2class and a practical example (they're included in the source code as well).
Sample code
In case you want to see xml2class in some "real life" situations, I offer here some raw, but working code fragments: X2cPrototypes.
Included are a simple, but fully operational String stack, a very basic address database and a quite well developed menu structure for accessing it (both based on XML), a very basic and tiny vocabulary trainer and a puzzle solver (Bewitched puzzle - solved by backtracking). Unfortunately they are not commented, but the code should be quite self-explanatory.
Download the complete source code collection as java archive (jar - 55 KB) or as zip archive (52 KB). You'll get no support on it; but that doesn't mean that you won't get any help at all.
Advantages
xml2class serves for very facilitated data and data structure handling in XML for Java. It may be useful in the following (and some more) situations:
- if you want to store data to a XML file, you'll just have to write one small method for each of your data classes so that the data object may be saved and retrieved with just two lines of code.
- even if you want to build some data structure basing on quite invariable data (such as menu structures), it may be easier to describe the structure in XML and parse it at runtime (like this you may even change the data structure's content on the fly - without having to recompile its code).
- if you're not sure of the abilities of a new data structure, construct an example in XML - and then use it directly in your program.
- if you want to work with XML data, but you don't like the size or the complexity of Xerxes or any other XML parser, consider that xml2class is just 14 KB in size and for daily use, you have to know only two methods.