Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] checkDetach vs. checkRemoveChild

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: jcowan AT reutershealth.com
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] checkDetach vs. checkRemoveChild
  • Date: Tue, 9 Mar 2004 22:50:38 -0500

At 4:46 PM -0500 3/9/04, jcowan AT reutershealth.com wrote:


Well, within a single package of XOM subclasses, it's redundant
to have checkAttach and checkDetach, because you can always use
the double-dispatch pattern: the parent can ask the child via a
package-private interface "Do you want to be attached to/detached
from me?" Where it gets important is when multiple packages are trying
to interact, since the parent has no way to get the child's input on
the subject.

That's ugly. With or without double dispatch my question is still why does the child care what its parent is? Especially if the parent doesn't care what its child is? Is it that you'd like an HTMLElement that could only be a child of an HTMLElement or an HTMLDocument, but could not be a child of a generic Document or Element?

I guess I'm stuck on the fact that with the notable exception of Schematron, most validity rules flow from the parent top the child, not the other way around. When we write a DTD or a schema we list the allowed children, not the allowed parents.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page