[jdom-interest] SAXOutputter

Laurent Bihanic laurent.bihanic at atosorigin.com
Thu Apr 22 08:12:56 PDT 2004

Bradley S. Huffman wrote:
>>I gave a second thought to output(Content) and I think I'll change it to 
>>output(Element) as any Content other than Element will lead to ill-formed 
>>document. Conversely, outputFragment(Content) does not have this issue.
> Doesn't output(List) already lead to ill-formed documents?

No, output(List) *may* lead it ill-formed documents if the top-level list 
objects are not legal at the document level (e.g. Text or CDATA nodes, 
multiple Element nodes, etc.). If the list is made of a single Element plus 
PIs and Comments, the outputted XML is well-formed.

output(Content) would output well-formed XML only if the node is an Element. 
In any other case, the output is ill-formed. Thus, while 
outputFragment(Content) is OK, output(Content) is not and should be changed 
into output(Element) (if we decide to add such a method).


More information about the jdom-interest mailing list