[XML-DEV Mailing List Archive Home]
[Reply To This Message]
Re: java and xpath
- From: c b <cindyloo_home@y...>
- To: Liam Quin <liam@w...>
- Date: Tue, 1 May 2007 08:27:09 -0700 (PDT)
so I shouldn't be utilizing the double-forward slash "//" but the single forward-slash since "//" goes to the root node and then gets all descendants? I believe early-on I did do that but got a bit lost b/c I hit the default namespace prefix problem and just tried to make it work...
therefore, I should be doing "/sdp:service/sdp:trip", correct? Even so, though, should I be using a different library? XPathAPI vs JAX vs.. ? can you make a recommendation
... I am not sure how I would go about using XQuery from within Java though... it seems that is a better fit for jsp/html pages, etc. why do you think that would be better for my purposes?
Liam Quin <liam@w...> wrote:
On Tue, May 01, 2007 at 07:56:57AM -0700, c b wrote:
> I have a data-oriented XML schema db that contains mostly scheduling
> information.. I have attempted to use javax.xml.* library to query
> the db, with abysmal performance.
> statements such as
> xpath.evaluate(doc,"//sdp:service//sdp:trip) or even the pre-compiled version
> are an order slower than the DOM call getTagByName("trip").
Most libraries have difficulty optimising // like that.
You are saying (in theory),
go through the entire document, and for each element,
look through all of its descendants,
and for each such descendant node, if it's an sdp::service
look through all of its descendents
and for each such descendant node, if it's an
add it to the result list
Have you tried, for example,
> I see there are many
xpath enabled libraries.. is there one in which
> xpath utilization is much faster? at least on par with the DOM
> I've looked on the web and it seems that query processing
> optimizaiton is an academic pursuit of it's own...
Yes, there are conferences for it too. Just as with SQL optimization,
> Should I rather be using DOM's new implementation of XPath ? should
> I be using an RDBMS rather than an xml db at all if query
> performance is going to be so slow?
You might want to try XML Query.
But first write XPath expressions that are as precise as you can.
there would never be any need to write
because name is always a direct child of student, and you don't
Similarly, //student is needless, because
will get you there directly.
In XQuery there are implementations that will look at a schema
(using W3C XML Schema) for your data, if you have one, and deduce
this, so that the expressions /students/student and //student would
be equivalent. Both open source and proprietary implementations
of XQuery do this sort of optimization (and so do some XSLT
implementations, but it sounds like XQuery would be a better fit here)
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/ * http://www.fromoldbooks.org/
Using Mandriva Linux, http:///www.mandrivalinux.org/
| [Thread Prev]
| [Thread Next]
| [Date Next]
| [Thread Index]
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
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