aspose file tools*
The moose likes XML and Related Technologies and the fly likes Can an  XML Node be converted to a String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Can an  XML Node be converted to a String" Watch "Can an  XML Node be converted to a String" New topic
Author

Can an XML Node be converted to a String

Joya Patterson
Greenhorn

Joined: May 27, 2005
Posts: 2
Is it possible to convert an XML Node to a string?

Can this :
<root>
<child1>Me</child1>
<child2>You</child2>
</root>

be converted to:

"<root><child1>Me</child1><child2>You</child2></root>"


When I try root.getChildNodes().toString(), I do not get the result I am looking for.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
You probably are looking for an XML file to a string, if I am not mistaken.
If that is the case, then you can use any Java I/O API to do this.

Converting an XML Node to a string means, converting the "value" of an XML Node to a string. BTW, an XML Node means - an XML Element, or an XML attribute or just simply the text inside an XML file. The "value" each such node depends on what type of Node it is.

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
 
subject: Can an XML Node be converted to a String