This discussion is archived
1 Reply Latest reply: Apr 7, 2009 3:57 AM by gimbal2 RSS

Getting XPath from java

807588 Newbie
Currently Being Moderated

I am having a xml file like this:


I want to read this xml and get the x-path for the particular value using a java class.

i.e., If I enter "B" as commandline argument then I should get the X-Path as book\chapter1\content1-2.

How to do this, please explain in step by step procedure.

Thanks in advance,
  • 1. Re: Getting XPath from java
    gimbal2 Guru
    Currently Being Moderated
    after 19 posts you should have figured out by now that people are not going to do your homework for you. Research java and xpath yourself and see what kind of libraries can help you. Try to write some code first and if you get stuck, post what you have done and people can guide you.

    I will at least give you a nudge. If you are completely new to Java and XML, I would look into the SAX parser. Using it you can learn how to parse an XML document at the lowest level and really get a feel for it. From there you can go to the next step of using DOM and Xpath.