[jdom-interest] parentless DOM nodes created by DOMOutputter
Elliotte Rusty Harold
elharo at metalab.unc.edu
Fri Apr 12 13:13:06 PDT 2002
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.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (IDG Books, 2001) |
| http://www.cafeconleche.org/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list