velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Anakia and jdom
Date Tue, 03 Jul 2001 21:53:55 GMT
piero de salvia wrote:
> 
> 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?

JDOM is the Bee's Knees.
 
I heart JDOM.

<fud>
JDOM is also a JSR, so you might find support in the JDK eventually.
</fud>

I actually know nothing about dom4j.

> 
> 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)

How does this affect you as an Anakia user?


-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!

Mime
View raw message