[jdom-interest] Does this exist?

Jason Hunter jhunter at acm.org
Mon Nov 27 19:41:19 PST 2000


Jon Baer wrote:
> 
> Would it be possible to add a utility method to Element that 
> returns the XML form of the Element:
> 
> Element.toXML()
> returns "<" QualifiedName + Attributes + ">"
> Or run XMLOutputter on it?

It would normally be a simple public method on XMLOutputter like
printElementStartTag(), but it's not because of namespaces.  The
XMLOutputter logic that prints that part of an element's representation
has to take into consideration the current namespace stack.  I'm not
sure what you'd want to have done with namespaces here.  Always have an
xmlns declaration if the elt is in a namespace?  Since it's not useful
except as a debug line, I'd rather leave it out for the time being.

-jh-



More information about the jdom-interest mailing list