aspose file tools*
The moose likes XML and Related Technologies and the fly likes parsing xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "parsing xml" Watch "parsing xml" New topic
Author

parsing xml

angelin precilla
Ranch Hand

Joined: Sep 11, 2007
Posts: 33
Hi,

Can any one help me how to parse xml using struts.
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
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

Joined: Sep 11, 2007
Posts: 33
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 ?
Rahul Nair
Ranch Hand

Joined: Dec 01, 2007
Posts: 138
[ UD: Removed hijack. Please start a new topic for unrelated questions. ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42608
    
  65
Moved to a more suitable forum, since the question has nothing to do with Struts.


Ping & DNS - my free Android networking tools app
Prabhakar Reddy Bokka
Ranch Hand

Joined: Jul 26, 2005
Posts: 193


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.


SCJP 5, SCWCD 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: parsing xml