[jdom-interest] XMLOutputter::outputString(...) throwing IOException
telrod at e2technologies.net
Wed Apr 25 22:03:52 PDT 2001
Hello all. I am fairly new to JDom and this list, so please forgive me if
this is just an ignorance question or has already been covered on the list.
I was wondering why XMLOutputter's outputString(...) methods throw
java.io.IOExceptions? I didn't see where either the Element or Document
passed as arguments could be holding on to file handles or where the
IOException could come from.
I was also wondering what I should use to output and Element I build into a
well-formed XML String. When I use the following code:
org.jdom.Element eventElement = new org.jdom.Element("event");
eventElement.addAttribute(new org.jdom.Attribute("name", event.getName()));
eventElement.addAttribute(new org.jdom.Attribute("type", event.getType()));
org.jdom.Element start = new org.jdom.Element("start");
org.jdom.output.XMLOutputter xmlOut = new org.jdom.output.XMLOutputter();
xml = xmlOut.outputString(eventElement);
The String variable 'xml' turns out to be:
name=AJUG Meeting, start= Thu Jul 12 19:00:00 EDT 2001, end=Thu Jul 12
21:30:00 EDT 2001, description= This is a description of the events...
<event name="AJUG" type="AJUG"> <start>8/18/01 7:00 PM</start><end>8/18/01
9:30 PM</end> <description>This is a description of the events...
as I expected it to be. Is there another way to achieve this? I tried
toString() and getSerializedForm() methods of the Element class, but the
later is not implemented yet and the former does not produce the desired
Just curious. Thanks for any help.
More information about the jdom-interest