File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes XML Parsing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML Parsing" Watch "XML Parsing" New topic

XML Parsing

Sindhu Kodoor
Ranch Hand

Joined: Sep 03, 2010
Posts: 66

I am having a JMS application , where the publisher-subscriber model is used, and the subscriber is notified when a message comes into the queue, the messages picked up is xml files which are of large size. All that comes out of the subscriber program is the xml file name, which is a good parser to parse this xml?

And also if I am getting the structure of the xml as this :

If I need to pick up the value of project tag with the condition that the scheme should be "http:\\xxx\xyz\abc\one.html" then how would I write the syntax of the XPath?

I tried this :

this does not work .. please help!!
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

All of that business about where the data comes from and how you get it is irrelevant to what parser you should use. What is relevant, however, is the part of your post about XPath expressions. If you plan to use XPath expressions then you should use a parser which supports XPath. As far as I know streaming parsers don't.

As for the expression, I'm amazed that somebody should decide to use identifiers which look sort of like HTTP URL's but use backslashes instead of slashes. What's up with that? Anyway your problem is simply that you're creating a Java string which attempts to include backslash characters but doesn't escape them properly. Nothing to do with XML at all. You need this:

Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 195

You should use SAX parser to parse the xml.
SAX is event based. So, based on the condition you can get the value of the specific event/tag.

I agree. Here's the link:
subject: XML Parsing
It's not a secret anymore!