• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get a part of xml document in String format

 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
How to get a portion of a xml document in String format.

>
So I want to read only from element B (So it wil B C & D) and get the representation of this in String with the xml tag names as well.
I tried XPath which provides the element values only and not the tag names.

Also want to avoid recursively iterating and generating the xml document.

Looking for some thing neat like (XPath not necessary):

XPath.evaluate("B","XMLDoc.xml") // and the result be as above.
Thanks

P.S. the xml documents do not have any attributes.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any one pls?
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I found a pretty good solution.

I put a simple XSL stylesheet like:


This ll actually copy the xml document.

Then I used the XSL transformation java api to call this from application and pass the DOM...

Aryan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic