• 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

parsing xml

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

Can any one help me how to parse xml using struts.
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as I know, parsing an XML hasn't got anything to do with Struts as such. You get an XML => you parse it and create a bean object (or any other suitable object); that's entirely your call.
You might want to consider reading up on the StAX parser, the SAX parser, or the DOM parser.
There are plenty of other implementations as well, but I think these would suffice for now. Considering what each of these parsers have to offer, and what your requirements are, you should make a call.
Personally, I would recommend the StAX parser for its balance of ease of use vs. performance.
 
angelin precilla
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My code is


I am getting the values , but the value of document and root is null.
My console outputs the following


Why am i getting null values ?
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[ UD: Removed hijack. Please start a new topic for unrelated questions. ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to a more suitable forum, since the question has nothing to do with Struts.
 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

2008-03-13 16:05:36,328 INFO [STDOUT] xmldoc :[#document: null]
2008-03-13 16:05:36,328 INFO [STDOUT] Root :[DatabaseList: null]
2008-03-13 16:05:36,328 INFO [STDOUT] ***************************



The null displayed in the out put is related to some documentation in the xml.
The Objects are not null but some value in side them is null.

[#document: null] - Document Owner Name
[DatabaseList: null] - First Child Element.

If you provide proper comments <DOCTYPE>, etc.., in your xml, you may see the values in them.
 
reply
    Bookmark Topic Watch Topic
  • New Topic