Hi!
I'm done with improving Anakia. I managed to preserve total backward
compatibility, while adding support for the new, more intuitive syntax.
There are no new objects in the context, however I've introduced a subclass
of Element (with necessary plumbing in form of a customized JDOM factory)
that has both a selectNodes() method for applying XPath to it and a
toString() that renders the element as an XML fragment - so that it
essentially behaves as a single-element NodeList. Also, all its methods
returning List (getChildren, getContent, getAttributes, selectNodes) are
overridden to wrap the returned lists into a NodeList.
Also all other context objects that used to return lists (XPathTool and
TreeWalker) now also return a NodeList (NodeList is a java.util.List so
nothing is broken).

See notes on "Context Objects" section of xdoc for details.
I've also fixed a bug in TreeWalker where it returned a single Vector object
across calls.
That way

  #set $all1 = $treeWalk.allElements($element1)
  #set $all2 = $treeWalk.allElements($element2)

would return the same object for $all1 and $all2 (effectively corrupting
$all1). I rewrote it to return new object on each call.

Also, I've done a FIXME in AnakiaTask where it constructed the project JDOM
on each process call. I moved project JDOM construction into execute(), so
it's now executed once per task invocation, not once per input XML file.

Attached are "diff -u"s of existing files and the sources of new files.
Whoever imports this into CVS could take care of @version tags for Javadocs.
I didn't find any information regarding how should they look like.

Cheers,
  Attila.

anakia.zip

Reply via email to