• 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

passing xml around application

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

I' wondering what best-practices exist when it comes to passing a xml document around in an application. The most simple alternative would be simply to pass it around as a String, but then you would have to parse the String everytime you need to use the information in the document. Another option could be to build a org.w3c.dom.Document and pass that around, but those are not serializable (right?) and that's no fun if you have an application that could potentially be distrubuted in the future.
What I'd like to know is what good or bad experiences people here have of different approaches, and what you would recommend.

Thank you!
 
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
Inside a single application I pass around DOM references - sometimes to a Document, sometimes to a single Element. I like constructors that take an Element for example.

Between applications I think you will have to go with the XML document as a character stream or file. That makes testing SO much easier and the parsing is pretty fast if you dont validate.

Bill
reply
    Bookmark Topic Watch Topic
  • New Topic