Skip to Content.
Sympa Menu

xom-interest - RE: [XOM-interest] Convenience methods for adding text in ParentNode

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: "Michael Fitzgerald" <mike AT wyeast.net>, "XOM" <xom-interest AT lists.ibiblio.org>
  • Subject: RE: [XOM-interest] Convenience methods for adding text in ParentNode
  • Date: Tue, 22 Oct 2002 09:53:37 -0400

At 6:29 AM -0700 10/22/02, Michael Fitzgerald wrote:
Likewise, I think

nu.xom.Node getNextSibling()
nu.xom.Node getPreviousSibling()

could move to Element as a child of Document (the document element) would
never have an Element sibling. Or do you consider items in the prolog
(comments and PIs) to have sibling relationships? I trow not.


Yes, elements in the prolog such as comments and PIs do have sibling relationships. More importantly, comments, processing instructions, and text nodes inside the root element (at whatever level) have sibling relationships. Siblings aren't just for elements. I agree that getNextSibling and getPreviousSibling don't make a lot of sense for Document, but they do make sense for Element, Comment, Text, and ProcessingInstruction.

Here I'm running into a problem with Java's lack of multiple inheritance. I can't break out separate classes for ParentNode and ChildNode when Element needs to be both. :-(
--

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| XML in a Nutshell, 2nd Edition (O'Reilly, 2002) |
| http://www.cafeconleche.org/books/xian2/ |
| http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+




Archive powered by MHonArc 2.6.24.

Top of Page