Maybe the javax.xml.xpath classes come in some other jar file that you need
to add
to your classpath?  Some  extra Java Enterprise Edition package  or
something ?





On Fri, Jan 15, 2010 at 6:12 PM, P T Withington <[email protected]> wrote:

> I have a nifty table of OL versions:
>
> <?xml version="1.0" encoding="utf-8"?>
> <versions>
>  <branch url="http://svn.openlaszlo.org/openlaszlo/trunk";>
>    <entry revision="15440" release="Latest" id="4.8.ptw" />
>  </branch>
>  <branch url="http://svn.openlaszlo.org/openlaszlo/branches/4.6";>
>    <entry revision="14738" release="Production" id="4.6.0" />
>    <entry revision="14744" release="RC" id="4.6.1" />
>    <entry revision="14781" release="Production" id="4.6.1" />
>    <entry revision="14814" release="RC" id="4.6.2" />
>    <entry revision="14827" release="Production" id="4.6.2" />
>    <entry revision="14913" release="RC" id="4.6.3" />
>  </branch>
>  <branch url="http://svn.openlaszlo.org/openlaszlo/branches/4.7";>
>    <entry revision="15428" release="RC" id="4.7.0" />
>  </branch>
> </versions>
>
> And I can get the url and revision from svn info.  So I want to be able to
> look up the release and id with:
>
>
> /versions/bran...@url='${svninfo.entry(url)}']/ent...@revision&lt;${svninfo.entry.commit(revision)}][last()]...@release]
>
> /versions/bran...@url='${svninfo.entry(url)}']/ent...@revision&lt;${svninfo.entry.commit(revision)}][last()]...@id]
>
> I found a nifty script:
>
>    <scriptdef name="xpath-query" language="javascript">
>        <attribute name="query"/>
>        <attribute name="xmlfile"/>
>        <attribute name="addproperty"/>
>
>        <![CDATA[
>            importClass(java.io.FileInputStream);
>            importClass(javax.xml.xpath.XPath);
>            importClass(javax.xml.xpath.XPathConstants);
>            importClass(javax.xml.xpath.XPathFactory);
>            importClass(org.xml.sax.InputSource);
>
>            var exp = attributes.get("query");
>            var filename = attributes.get("xmlfile");
>            var input = new InputSource(new FileInputStream(filename));
>            var xpath = XPathFactory.newInstance().newXPath();
>            var value = xpath.evaluate(exp, input, XPathConstants.STRING);
>
>            self.project.setProperty( attributes.get("addproperty"), value
> );
>
>        ]]>
>
>    </scriptdef>
>
> But ant tells me it knows nothing about `javax`.  Help?
>
>
>


-- 
Henry Minsky
Software Architect
[email protected]

Reply via email to