• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Dom or SAX parser for reading Market feeds?  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to design a Feed reader, If I want to read market data from any stock exchange or any such website where performance is a critical factor, and also I need to conserve my bandwidth by not reading the whole lot of thing everytime, I only need to the data that is changing and parse it and update my client that is connected my feed reader for a given financial instrument.
Any suggestion which one to use?
 
Sheriff
Posts: 23689
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use either of them.

As for only getting the data which is changing, you would have to arrange with the people who make the feeds to provide you with that information. There isn't a "give me only the changed data" on any RSS feed I've ever seen. Otherwise you will have to download all of the data anyway and compare it to the previous version, which you saved from the previous run.

So given that you're going to be downloading the whole page anyway, it makes very little difference which parser you use.
 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response paul.
So ideally, I get an xml everytime, and I need to parse it fully anways and then if at all I have cached it previous time, I need to compare the object values and if I see any difference then take action to update my clients. From my research I found out that dom loads the whole xml as a tree and traverses the tree to build the object list and sax is event driven. Assuming that i have enough in memory, would it be advicible to use dom parser?

thank you,
Kavitha
 
Paul Clapham
Sheriff
Posts: 23689
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It all depends on what kind of programming has to be done. And it depends on the complexity of the input document, and how much data you plan to extract from it. In my opinion you should do whatever is easier to program.
 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okie. I will do that.
It was helpful getting your inputs.

Thank you,
Kavitha.
 
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the market data feed have a time-stamp? Preferably as an attribute very early in the XML stream - if so you could use StAX and decide early on not to continue processing if the time-stamp has not changed.

Bill
 
Kavita Shivani
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats a good question. I assume it will. I shall clarify that part.
thank you,
Kavitha.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!