• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XPath and Java 2 SDK

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there way to use XPath expressions to get data from Document?

Vladas
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somehow it doesn't seem convenient to assign every element unique ID. And by tag name it returns multiple elements though i know there is only one.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vladas Razas:
Is there way to use XPath expressions to get data from Document?


Yes, there is.

When J2SE 1.5 gets finished, it will bring us a standard Java API for XPath. Before that, you'll have to use alternatives like Apache Xalan's XPath implementation and API.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vladas Razas:
Somehow it doesn't seem convenient to assign every element unique ID. And by tag name it returns multiple elements though i know there is only one.


That's just the way it is. If you can't uniquely identify the element you want, you'll have to resort to picking the first occurrence from a list of matching nodes -- even though you know there will be only one node in that list.
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! I was thinking there must be one. And going little crazy because I couldn't find it. Like geography teacher who can't find an island on the map

By the way JDK exposes only interfaces and factories. What are implementations? Does it use Xalan underneath? Just curious.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vladas Razas:
What are implementations? Does it use Xalan underneath? Just curious.



If I understood this link correctly then its going to use apache.see also this link..
Lasse!.. is that right ?
 
There's a way to do it better - find it. -Edison. A better tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic