• 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

Too Many XML Related Technologies: Please Advise

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

I'm trying to find the best way to work with XML and Java. I have
a lot of experience with Java, but this is my first time doing anything with XML. For now I just need to validate the xml and extract the "value" of an element, but eventually I'll be doing more. I have searched around a lot investigating SAX, DOM, JAXB, and Castor. I would like to learn the tool/API that is most accepted and follows standards the closest. What do you think the best choice is out of SAX, DOM, JAXB, Castor and other tools/APIs?

Thanks in advance.

/ron
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest mulling over some issues:
  • Do you want to use XMLSchema or DTDs to define your documents?
  • Are only reading/parsing XML docs, or writing XML documents too?
  • Do you need support for every possible XML document feature, like processing directives?
  • Are you processing small numbers of big documents, or big numbers of small documents?
  • Which deployment environments do you need to support (a big issue with J2EE apps)?


  • Those are probably the things you need to start thinking about in order to figure out which option will be the best fit for you.
    [ March 08, 2006: Message edited by: Reid M. Pinchback ]
     
    Ron Price
    Greenhorn
    Posts: 13
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Reid, thanks for the quick useful response<b>
    Here is my response the questions, please try to do direct me towards
    a specific technology.

    * Do you want to use XMLSchema or DTDs to define your documents?
    Both
    * Are only reading/parsing XML docs, or writing XML documents too?
    Mostly reading, possibly in the future I may be writing.
    * Do you need support for every possible XML document feature, like processing directives?
    No.
    * Are you processing small numbers of big documents, or big numbers of small documents?
    For now, small number of small documents.
    * Which deployment environments do you need to support (a big issue with J2EE apps)?
    Hmmm, well I would prefer the choice to limit my ability to turn my code into a J2EE app.<br>

    I would like to learn the best one, please chime in with your opinions.

    Thanks.
     
    Ron Price
    Greenhorn
    Posts: 13
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sorry about that last post, it was premature and I just noticed the UBB stuff. In true greenhorn fashion here is my addendum to my last post, please ignore the first.

    Reid, thanks for the quick useful response.

    Here is my response to the questions, please try to do direct me towards
    a specific technology.

    * Do you want to use XMLSchema or DTDs to define your documents?
    Both

    * Are only reading/parsing XML docs, or writing XML documents too?
    Mostly reading, possibly in the future I may be writing.

    * Do you need support for every possible XML document feature, like processing directives?
    No.

    * Are you processing small numbers of big documents, or big numbers of small documents?
    For now, small number of small documents.

    * Which deployment environments do you need to support (a big issue with J2EE apps)?
    Hmmm, well I would prefer the choice to not limit my ability to turn my code into a J2EE app.<br>

    I would like to learn the best one, please chime in with your opinions.

    Thanks.
     
    Reid M. Pinchback
    Ranch Hand
    Posts: 775
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Since you don't care about processing instructions you aren't forced in the direction of technologies that have APIs to accomodate them, like SAX and DOM, but they remain as options.

    If you really want to use both DTDs and XMLSchema, that eliminates technologies that only know XMLSchema, like JAXB and XmlBeans. Unfortunate; they are convenient and fast for situations where you want object trees that faithfully represent the XML document structure.

    If you expect to both read and write XML, use both XMLSchema and DTDs, then when all is said and done I think you've narrowed down to the technologies capable of that combination. I think you are down to SAX and StAX, or DOM+XSL.

    For small documents all three are reasonable choices, each has different warts, different learning curve issues. I haven't mucked around with the SAX-based mechanisms for creating XML, no opinion on those. DOM is easy once you learn how the tree nodes are really constructed. StAX is more a case of looking to the future - better performance and I think more output options than SAX, but more need to roll up the shirtsleeves, particularly for document validation.

    No opinion on Castor, haven't used it.
     
    I like tacos! And this 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