[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

IBM xml4j parser vs. Datachannel

  • From: "Mike Lepley" <mlepley@w...>
  • To: <xml-dev@i...>
  • Date: Tue, 12 Oct 1999 18:39:26 -0400

com.ibm.xml.parsers.domparser download
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:

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

and the Datachannel

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
parser.

Thanks in advance!
Mike

---------------------------------

import java.io.*;
import java.net.*;

import com.ibm.xml.parsers.*;   // 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


   com.ibm.xml.parsers.DOMParser parser =
   new com.ibm.xml.parsers.DOMParser ();

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

   doc = parser.getDocument ();
      }
      catch (Exception e)
      {
         e.printStackTrace();
         return;
   }

      // 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@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.