Helpful XPath API's
Return to home page
Comments Loading...
2004-08-01

The XPath package in VisualWorks was made for their XSLT library. They've been doing work on it. I fixed a couple of bugs in it about a year ago now and published them to public store too. I think some of them got accepted, it's hard to tell :)

But today I published a new version to public store that includes an easy to use API for matching nodes in your DOM tree using XPath:

anXMLNode xpathLocate: '//foo/baz[2]/bar/text()'

It's that simple now. As simple as it should be in fact. You can pass it a string or you can pass it a pre-built XPath expression. You can pre-build the XPath expression like so:

'//foo/baz[2]/bar/text()' asXPathLocation

You can also pass in variables for the XPath expression like so:

anXMLNode xpathLocate: myXPathExpression variables: (Dictionary new at: 'foo' put: 'bar'; yourself)

And there you have it. Hopefully this API will be picked up by the Cincom engineering team for the 7.3 release