xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
- To: xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] Remarks on 1.0d9 API
- Date: Fri, 7 Feb 2003 07:19:33 -0500
Hi,
Few more remarks on XOM 1.0d9 API:
1. What is the purpose of Element.getFirstChildElement methods now that getNextSibling has been removed?
Mostly it's for the case where you want to get what is likely the only such child element without having to iterate though a list. e.g. given
<name><personal>Laurent</personal><family>Bihanic</family></name>
you can call name.getFirstChild("personal") to return the personal child element which may be the 1st or 2nd child element. I also considered getOnlyChildElement() here, and throwing an exception if there was more than one, but that seemed more complex, and not obvious that it really helped.
2. In the Javadoc of the Element class and of Element.getNamespacePrefix, the description of the possible prefix values is not clear. Cases where the prefix is null (no namespace?) or an empty string (default namespace?) shall be detailed.
This is scheduled to be changed (and cleaned up) in the next release. It will return all prefixes locally declared on the element, both the element's own, the attributes' own, and any additional prefixes, after removing duplicates.
3. Constructors taking 3 arguments (local name, namespace prefix and namespace URI) would be welcome for both Element and Attribute. I encountered the case where I had to concatenate the prefix, ':' and the actual name to invoke a constructor that performs the opposite operation!
This one I don't see. It's too hard to remember whether the prefix or the local name comes first, and it doesn't provide any functionality you don't have already. The benefit just doesn't seem worth the complexity cost of the added methods.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo AT metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| Processing XML with Java (Addison-Wesley, 2002) |
| http://www.cafeconleche.org/books/xmljava |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
-
[XOM-interest] Remarks on 1.0d9 API,
Laurent Bihanic, 02/07/2003
- Re: [XOM-interest] Remarks on 1.0d9 API, Elliotte Rusty Harold, 02/07/2003
Archive powered by MHonArc 2.6.24.