[jdom-interest] parentless DOM nodes created by DOMOutputter
Jason Hunter
jhunter at servlets.com
Fri Apr 12 13:24:38 PDT 2002
Elliotte Rusty Harold wrote:
>
> The DOMOutputter class contains these two methods:
>
> public org.w3c.dom.Element *output*(Element
> <http://www.jdom.org/docs/apidocs/org/jdom/Element.html> element)
> throws JDOMException
> <http://www.jdom.org/docs/apidocs/org/jdom/JDOMException.html>
> public org.w3c.dom.Attr *output*(Attribute
> <http://www.jdom.org/docs/apidocs/org/jdom/Attribute.html> attribute)
> throws JDOMException
> <http://www.jdom.org/docs/apidocs/org/jdom/JDOMException.html>
>
> The DOM contract is that every Attr and Element (and every other Node
> too) always belongs to exactly one Documnt or DocumentFragment object.
> What document would the return values of these methods be placed in? Or
> are we violating the DOM contract somehow with these two methods? Even
> if we manage to create orphan nodes, since the ownerDocument attribute
> in Node is read-only, these nodes we create cannot be adopted into a
> different DOM document. I suggest we remove these methods, possibly
> after deprecating them for a release cycle, though I doubt very much
> anyone is using them.
Yes, it'd be good to hear who if anyone is using them, and how.
What about returning a DocumentFragment?
-jh-
More information about the jdom-interest
mailing list