aspose file tools*
The moose likes XML and Related Technologies and the fly likes Convert xml to Java String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Convert xml to Java String" Watch "Convert xml to Java String" New topic
Author

Convert xml to Java String

Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 115
Hi I am having the following xml document (sample)



I want to create each EmpDetails as String of xml format, how to convert? for sample i want to convert to java String.(name space has to be included)


any idea?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Nevermind. My mistake.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18155
    
    8

I would load the document into a DOM, and then for each element for which you want to output a String, use an identity XSL transformation to transform it into a String.

Or did you already have that idea but you had a problem with some particular part of it? If so, asking about that particular part would have been more practical.
Shankar sanjay
Ranch Hand

Joined: Sep 14, 2009
Posts: 115
Looking some idea or some sample code, the problem is extracting with name space
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18155
    
    8

That was an idea. You can get sample code from the tutorials.

And no, the namespaces are not a problem. Why do you say that is "the" problem?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert xml to Java String
 
Similar Threads
Eliminating the XML Declaration when creating XML
altering the xml output for axis2 soap response
XML String to Document
XML newbie: how to construct this tag?
Struts 2 and UTF-8