Home jXML Package Ringlord Technologies: Amiga/Java/Linux
  About     News     Products     Publications     People / Contact us     Links
Overview

Amiga

Java
INDEX
Archive
Server
SMTP
SQL
Util
XML
Octopus
TrackTime


GNU/Linux
 
Product Quick Summary: jXML
Description This is a relatively simple but fast XML parser, (non-standard) document object model, and XML generator. It recognizes the encoding attribute of XML documents, and preserves (but does not otherwise make use of) the DOCTYPE and DTD of the document. It is able to process CDATA sections, too, and decode them automatically.

This parser's main strength lies in its size (five classes), speed, ease-of-use, and the strong diagnostic abilities that will help you fix mistakes in your XML.

Reads documents with namespaces but does not treat the colons ( : ) for namespaces different from any other character (i.e. it will read and reproduce the documents correctly, but treat ns:foo merely as a name with a colon in it rather than one belonging to a namespace). Other than that, the parser is fast, and its overhead is as small as possible (except for the fact that it stores entire XML documents in memory.)

Included is a ready-to-use JAR file, a README to get you started, pre-generated Javadoc, and the source code.

Please note: If you need full-featured XML compliance with all the bells and whistles, you should look into Xerces from the Apache Project, instead!

Note: JProfiler appers to have trouble with classes compiled with IBM's Jikes java compiler when using profiling hooks. The symptom is a byte code validation error that does not exist in the original, unmodified code that we distribute here. The error is introduced through JProfiler's byte code manipulation to effect the profiling operations. In order to eliminate confusion in this matter we have rebuilt the JXML package using Sun's J2SE javac compiler beginning with the 2.9 distribution dated 15-Dec-2003.
Version 2.9   (15-Dec-2003)
Platforms Java 2 (v1.2.2 or later)
License GNU General Public License (GPL)
Download rlt-xml.tar.gz (69 kb)

This software is not fully XML compliant but for situations where name-space support and other advanced capabilities are not required, it is more than sufficient and can reduce significantly the distribution size and memory overhead for applications for which a "full-blown" and completely standards-compliant XML parser would be overkill.

This parser's predominant strength lies in its simplicity and light-weight implementation (five classes is all it takes), and its ease-of-use (see below). The software recognizes the "encoding" property in the "<?xml . . . ?>" header, preserves (but does not in any way use a DTD encoded or referenced by) a "<!DOCTYPE . . . >", and parses CDATA sections as well as a mixture of Node and text nodes.

In other words, it supports the majority of key-features of XML and cuts out the 10% that would increase the code size and resource requirements many times over.

If you are looking for a parser that supports SAX or DOM, on the other hand, this is not the one for you! If you need name space support, schema validation, or anything beyond the basic features, or you wish to engage in full-scale and uncompromising interchange of XML documents, you should probably look at a product like Xerces from the Apache Project.

One of the strengths of this parser is its diagnostic ability: a missing (or misspelled) closing element will be pointed out by name and line in the source; missing quotes or other syntactic errors will likewise be reported by line number in the source. Most other parsers report nothing more than "a problem"; our parser actually helps you fix problems!

This software is also ideal for structured configuration files, and easy handling of data mostly internal to an application, or where export/import of data does not rely on more than basic XML.

Example: Consider the following XML document (let's call it 'test.xml'):

<!xml version="1.0" encoding="UTF-8"?>
<xmlTest>
    <Name value="Banal XML Test"/>
    <Author>
	<Name value="Udo Schuermann"/>
	<Email value="nobody@nowhere.net"/>
	<Birthday>
		<Month value="9" name="September"/>
		<DayOfMonth value="3"/>
	</Birthday>
    </Author>
</xmlTest>

The following code demonstrates retrieval of the 'value' attribute of the <Name> Node:

import com.ringlord.xml.Document;
import com.ringlord.xml.Node;
class TestXML
{
  static final public void main( String[] args )
  {
    Document doc = Document.parse( new File("test.xml") );
    Node root = doc.getRootNode();
    System.out.println( "This is a '" + root.getName() + "' document" );

    Node author = root.getChild( "Author" );
    System.out.println( "The author's name is " +
                        author.getChild("Name").getAttributeValue("value") );
    System.out.println( "And all of the author's information is:n" +
                        author.toString() );
  }
}

The output of this program will be:

This is a 'xmlTest' document
The author's name is Udo Schuermann
And all of the author's information is:
<Author>
    <Name value="Udo Schuermann"/>
    <Email value="nobody@nowhere.net"/>
    <Birthday>
	<Month value="9" name="September"/>
	<DayOfMonth value="3"/>
    </Birthday>
</Author>
  Made With WebLordCopyright © 1997,1998,1999,2000,2001,2002,2003 Ringlord Technologies
The alteration of any part of this content by manual or automated means (adding, removing, or in any other way altering links, text, or images) constitutes misrepresentation of our content in violation of United States copyright law. For more details, please see our content ownership details page for elaboration.