File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Reading child tags as separate xml blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Reading child tags as separate xml blocks" Watch "Reading child tags as separate xml blocks" New topic
Author

Reading child tags as separate xml blocks

rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Hi All,

I have a sample xml:



now i have to read each <ROW> block from xml and send that as string to a method.

I'm using DOM parser, i tried it but unable to read each <ROW> as a separate block.

Kindly suggest to accomplish the above task.

Thanks,
Rakesh.


thanks & regards, Rakesh
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
read each <ROW> as a separate block.


Exactly what output would you like to see in the output String?

If you want a String containing both the XML tags and the text content, you will have to create it with DOM methods because the DOM model keeps the tag names and text content separate.

I always recommend study of the org.w3c.dom.Node JavaDocs. There is a lovely table there that summarizes how DOM keeps things like the names and content of tags.

Bill

Java Resources at www.wbrogden.com
rakesh kumar nampally
Ranch Hand

Joined: Feb 03, 2007
Posts: 46
Thank You for quick reply!!!

I got it i have used TransformerFactory to convert an xml (DOM) node into string representation.

sample code:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading child tags as separate xml blocks
 
Similar Threads
how to filter xml output from two xml files
how to retrieve same name elements in xsl
xsl: create href for one tag with value in param among multiple
xsl for xml tags with similar name
PLEASE HELP ME!!Creating drop down list using XSL