File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Head First Android this week in the Android 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).
Don't get me started about those stupid light bulbs.
subject: Converting an XML Node to XML String/Text
It's not a secret anymore!