[jdom-interest] String of Element

Matthew MacKenzie matt at xmlglobal.com
Tue Jan 30 11:03:49 PST 2001


You can do something like this:



public String myGetString(Element el) throws Exception {
	try {
		java.io.StringWriter sw = new java.io.StringWriter();
		org.jdom.output.XMLOutputter out = new
org.jdom.output.XMLOutputter("\t", true);
		out.output(el, sw);
		return sw.toString();
	} catch (Exception e) {
		e.printStackTrace();
	}
}


Cheers!
--
Matthew MacKenzie
VP Research & Development
XML Global Technologies, Inc.

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of pavel at enow.co.il
Sent: January 30, 2001 10:18 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] String of Element




Hi!

This is my first posting to the list :)

How can I receive String representation of some Element including all its
children?

Somthing like Element.getString() which will give
"<ELEMENT>text <CHILD> bla bla </CHILD></ELEMENT>" ?

Thanx

------------------------------------------------------------------------
Bernshtam Pavel                                               053-398944
Certified Java 2 Programmer                           pavel at chatscan.com

http://www.cs.bgu.ac.il/~barnshte
http://www.enow.com                            A million minds a minute!
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourh
ost.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2879 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010130/1f4196e2/smime.bin


More information about the jdom-interest mailing list