[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: [proposal] XPath API for Java


xpath api
JSR 206, which is defining JAXP 1.3 is undergoing community review at
the moment, the activity includes work on an XPath API.

http://www.jcp.org/en/jsr/detail?id=206

Michael Kay

> -----Original Message-----
> From: Bill de hÓra [mailto:bill@d...] 
> Sent: 20 September 2003 19:08
> To: xml-dev@l...
> Subject:  [proposal] XPath API for Java
> 
> 
> 
> Hi,
> 
> I've been through a ton of DOM-in-Java programming in the last 12 
> months. You learn early on to use XPaths where possible to keep the 
> code flexible and clean. But one of the annoying about using XPath 
> in Java is that it's all library specific.  The last thing I want to 
> have to do is go through all my code and replace Xalan stuff with 
> Jaxen stuff or Jaxen stuff with DOML3 stuff.
> 
> So here's a proposed api:
> 
> 
>    package net.amadan.markup.xpath;
> 
>    import java.util.Map;
>    import org.w3c.dom.Node;
> 
> 
>    public interface XPath
>    {
>      /**
>      * Match a xpath over a DOM Node.<p>
>      *
>      *
>      * @param target the Node to match against.
>      * @param xpath  the xpath as a String
>      * @param namespaces    keys are namespace URIs,
>      * values are namespace prefixes.
>      * @return the Nodes matching the expression, a size of 0 
> indicates no match.
>      * @throws IllegalArgumentException if the xpath is illegal or a 
> prefix is not bound to a key in <tt>namespaces</tt>
>      */
> 
>      List match( Node target, String xpath, Map namespaces );
>    }
> 
> 
> I don't ever seem to need the extra step of preparing an xpath 
> object and applying it later to a Node. I also figure managing any 
> expression caching and so on is a fun thing to do for the 
> implementor but gorp for the user.
> 
> Next step is a factory/plugin to this so anyone that does xpath in 
> java  can register a provider. It'll be  the usual 
> "FactoryFactory.getFactory().newInstance()" dance using a System 
> property ("net.amadan.markup.xpath.driver").
> 
> Bill de hÓra
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
<http://www.oasis-open.org>

The list archives are at http://lists.xml.org/archives/xml-dev/

To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.