• 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 in Java

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
I have an XML document stored in the database as CLOB.I need to query the document for data inside specific tags.I want to use XPATH for this.I read about XPATH.But I want to know how it can be used in a Java Program inside WSAD.Would appreciate if somebody can direct me to a sample source code that reads the XML document and extracts specific element data.Also,please let me know if there is any API that I can use...Any help ASAP would be great.
Many Thanks,
Prabha
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you expecting to write an XPath expression then use
that with a Java program and query the Db to get some value
out of the XML file.........
 
Prabha Dhandapani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Madhav,
Thanks for the reply.Actually, I have the XML file stored as a column in a table.I need to extract the file from the table which is fine.After extracting it,do i need to parse the XML file to use XPath???If that is the case, then I can parse it using DOM or SAX Parser...Once I parse it,how do I implement XPATH in the program to say get the valus of the "price" for the below xml???Please let me know if there are any examples for doing this. Also, do I need to parse the XML always to use XPATH or is there a way where I can use the XML direcly without parsing because I know parsing sometimes throws exception based on the XML File...
<book price="100">
</book>
Thanks,
Prabha
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You seem to be thinking correctly as far as getting the file from the
DB and then understanding the requirement to parse it.
Now for the part where you want the answer to getting the value
based on the XPath, I am kinda hazy on that...I myself am trying
to follow these tutorials for DOM/SAX trying to learn things.
Hopefully someone else has a better (direct) answer to your question.
regds.
- m
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic