This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Converting an XML Node to XML String/Text Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Converting an XML Node to XML String/Text" Watch "Converting an XML Node to XML String/Text" New topic

Converting an XML Node to XML String/Text

Krysty Sullivan
Ranch Hand

Joined: Jun 06, 2002
Posts: 48
How do I convert a Node to its corresponding XML Text or String?
Node pageNode = pageNodeList.item(0);
//How can pageNode be converted to XML String
(e.g. <param><page>2</page></param> ?
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1180
The interface Node has the method getNodeValue() which returns a String.
I guess this is what you are after.

William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Try this. But you will need Xerces.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
I agree. Here's the link:
subject: Converting an XML Node to XML String/Text