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

Re: [proposal] XPath API for Java

Bill de hÓra <bill@d...> writes:

> 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.

> So here's a proposed api:

>    public interface XPath

>      List match( Node target, String xpath, Map namespaces );

I think an interface with only a single method is of limited value,
given the range of XPath uses.

One thing I'd consider is a convenience method getSingleNode with the
same arguments - to eliminate the unnecessary cast (I realize things
will change in 2.0, but I hear some folks are sticking with 1.0). I
wasn't sure which List you refer to from the import statements; I
wouldn't use java.util.List because of the casting - consider the
better-typed NodeList.

I would also consider getBooleanValue() and getStringValue(). Also to
consider - what kind of exception will this class throw, for malformed
XPath strings, for instance. Will it be a subclass of DOMException?
Use a non-standard error code? many DOM application only declare
DOMException in their methods.



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.
First Name
Last Name
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.