• 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

Dom or SAX parser for reading Market feeds?

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Marshal
Posts: 28193
95
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats a good question. I assume it will. I shall clarify that part.
thank you,
Kavitha.
 
That feels good. Thanks. Here's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic