• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

XML Parsing

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

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!!
 
Sheriff
Posts: 28344
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:

 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic