IBM xml4j parser vs. Datachannel

Mike Lepley mlepley at
Wed Oct 13 00:36:33 BST 1999

At our firm we are considering using the XML4j parser.
The XML4j parser has gotten some excellent reviews.
That is why I cannot understand the test results that I've done myself.

For example:

                           Time to
File size  |  Tags  | visit all
3kb           100        .55s
2,229kb       7000       8.51s
6,368         20000      115.29s

and the Datachannel

                           Time to
File size  |  Tags  | visit all
3kb           100       .13
2,229kb       7000      2.99s
6,368kb       20000     9.76s

And I have many more data points all the way to a 10MB file.

Has anyone else experienced such poor results with the IBM parser?
Why is there such a difference?  I've included my sample code for the XML4j

Thanks in advance!



import*;   // For the IBM Parser stuff

import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;    // The W3C definition of a node
import org.w3c.dom.NodeList;

public class DOMibm4j
   int ELEMENT_NODE = 1;
   public static String szText = "";

   Document doc;

   public DOMibm4j (String file, String sch /**, RichEdit re */)
   try parser =
   new ();

   parser.setValidating (false);
         parser.parse (file + ".x");

   doc = parser.getDocument ();
      catch (Exception e)

      // Let's loop through all the nodes and look at them...

      for (int i=0; i < doc.getChildNodes().getLength (); i++)
         Visit (doc.getChildNodes ().item(i), 0);

   public void Visit (Node node, int spaces)
      // Recursively visits every node under this top node

      // Make sure that it's not an attribute or CDATA or processing
instruction, etc.

      if (node.getNodeType () == ELEMENT_NODE)
         int length = node.getChildNodes().getLength ();
         for (int i=0; i < length; i++) { Visit
(node.getChildNodes().item(i), spaces+5); }

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list