• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Efficent way to parse XML Data

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

I am not too familiar with DOM API. Currently I have the following XML File,



And My Java Code to parse it will be:



My Code seems not too efficient as it's kind of hard code.
My ideal wish will be getting values dynamically, please teach me how


Myriads of Thanks


Transistor

[ January 11, 2008: Message edited by: YuenLian Wu ]

[ January 11, 2008: Message edited by: YuenLian Wu ]
[ January 11, 2008: Message edited by: YuenLian Wu ]
 
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
XPATH provides an API with a more compact and elegant notation.

However, as I found out in this article, it is much slower than the direct manipulation of the DOM as in your example. That the tradeoff

Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic