velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From piero de salvia <pie...@yahoo.com>
Subject Anakia and jdom
Date Tue, 03 Jul 2001 21:19:10 GMT
Hi guys,

another "should i forget programming" question.

Should not Anakia use dom4j instead of jdom ? Is not
dom4j vastly superior to jdom, considering that we are
working with java?

consider how to get an XPath engine running in jdom:

DOMParser parser = new DOMParser();
parser.parse(DocName);
Element Site =
parser.getDocument().getDocumentElement();
xpathSupport = new XMLParserLiaisonDefault();
prefixResolver = new PrefixResolverDefault(Site);
xpath = new XPath();
XPathparser = new XPathProcessorImpl(xpathSupport);
XPathparser.initXPath(xpath, PathName,
prefixResolver);

and then eval an xpath expression:

XObject result = xpath.execute(xpathSupport, Site,
prefixResolver);

NodeList foundnodes = result.nodeset();
(...more suffering from not having a standard
Collection...)

same thing with dom4j :

SAXReader reader = new SAXReader();
Site =  reader.read(DocName);
List foundnodes = Site.selectNodes(PathName);

(have a java Collection)

bye

piero de salvia

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Mime
View raw message