Isn't something like this the JSTL equivalent of your code example:

<x:parse xml="${param.xmlDocument}" var="xmlDoc"/>
<x:set var="stuff" select="$xmlDoc//packet/param"/>

If you're really planning on iterating over each of the nodes:

<x:forEach var="item" select="$xmlDoc//packet/param">
  ...
</x:forEach>

Otherwise, if you really need to use a filter, you have to create an instance
and store it as a scoped attribute. It's probably better practice to do this in
a servlet (or action if you're using a framework like Struts) that operates on
the request before forwarding to the JSP:

XMLReader parser = XMLReaderFactory.createXMLReader();
MyXPathFilter filter = new MyXPathFilter("//packet/param");
filter.setParent(parser);
request.setAttribute("filter", filter);
// forward to JSP

If you need an implementation of an XPath XMLFilter (and since it sounds like
you use JDOM), it looks like org.jdom.contrib.input.scanner.ElementScanner might
work, but I've never used it.

Quoting Lorenzo Sicilia <[EMAIL PROTECTED]>:

> Hi to all,
> 
> I need filter a xmlDocument.
> 
> <x:parse filter="${filter}" xml="${param.xmlDocument}" var="xmlDoc" />
> 
> the problem is create a org.xml.sax.XMLFilter object in ${filter}.
> 
> I nees filter my xmlDocument with a Xpath string like "//packet/param".
> With Jdom I can try with this:
> 
> XPath filterPath = XPath.newInstance("//packet/param");
> List rows = filterPath.selectNodes(this.xmlDoc);
> 
> Can I do in jstl?
> 
> Best Regards Lorenzo Sicilia
> 
> p.s. Sorry for my poor english :)

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to