[
Lists Home |
Date Index |
Thread Index
]
- From: "Mike Lepley" <mlepley@worldnet.att.net>
- To: <xml-dev@ic.ac.uk>
- Date: Tue, 12 Oct 1999 18:39:26 -0400
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@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|