hi, i performed some test trying to select one node in a document with 10000 nodes (<name first="ssss" last="sss">) and the test said:
[bold]Using xpath[bold]
String xpath = "/doc/name[@first=\"Rodrigo\"]";
Node node = XPathAPI.selectSingleNode(doc, xpath);
[bold]it delay like 1970 milliseconds[bold]
[bold]Using dom[bold]
NodeList nodeList = (NodeList)doc.getElementsByTagName("name");
int length = nodeList.getLength();
for (int i = 0; i < length; i++) {
Element node = (Element)nodeList.item(i);
String name = node.getAttribute("first");
if (name.equals("Rodrigo")) {
break;
}
}
[bold]it delay like 1010 milliseconds[bold]
HOW CAN IT BE ?????
xpath is more slower than dom ??????
thanks
Rodrigo Gonzalez Asensio
Researcher & Developer
Buenos Aires - Argentina