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: jcowan AT reutershealth.com
- Cc: xom-interest AT lists.ibiblio.org
- Subject: [XOM-interest] Namespace methods
- Date: Thu, 5 Feb 2004 08:35:23 -0500
At 2:14 PM -0500 2/2/04, jcowan AT reutershealth.com wrote:
2) Consider flushing the no-namespace constructors: they save only 3 characters
(plus optional whitespace) over the corresponding namespace constructors.
Trying to let people use a namespaceless subset of XOM really doesn't save
much mental space, I don't think; DOM has these things because Level 1
predates namespaces.
The sentiment (including mine) is running against this. I'm keeping these.
2) Unify all namespace checking on a single routine, checkNamespace(String
prefix, String URI), to be called in place of checkNamespacePrefix,
checkNamespaceURI, and checkAddNamespaceDeclaration. In the first two
cases, the existing URI or prefix is passed. This allows applications
to enforce rules about prefix mapping. It also increases conceptual
compatibility with Attribute, which already has checkNamespace.
Checking the addition of a namespace declaration is potentially very different than checking the changing of a namespace for an element. checkAddNamespaceDeclaration will remain.
The reason Element and Attribute are asymmetrical here is that elements and attributes are not symmetrical. Because attributes are required to have prefixes to be in a namespace, the setNamespace method is different for the two. In Attribute, this means that you have to call setNamespace(prefix, URI) whereas for element you can call setNamespacePrefix(prefix) and setNamespaceURI(uri). Otherwise it would be possible to create an attribute in a namespace with no prefix, a very bad thing.(*) The check methods match the setter methods.
That said, I'm not sure they have to match. Element could fill in the prefix or URI as necessary from either setNamespacePrefix(prefix) or setNamespaceURI(uri) and then call checkNamespace(prefix, URI) or Attribute could call checkNamespacePrefix and checkNamespaceURI separately. Probably the latter makes more sense because otherwise the checks on prefix and namespace URI would each be made twice, once for the URI and once for the prefix. What do people think?
--
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
(*) In Element, calling setNamespacePrefix() before calling setNamespaceURI() throws an exception. However, the reverse order is allowed, because an element is still namespace well-formed if you call setNamespaceURI and then don't call setNamespacePrefix(). However, with attributes neither order could be allowed, because one without the other is always namespace malformed.
-
Re: [XOM-interest] XOM 1.0d23 Last Call
, (continued)
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
John Cowan, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Bradley S. Huffman, 02/02/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Bill de hÓra, 02/02/2004
-
[XOM-interest] Put methods,
Elliotte Rusty Harold, 02/05/2004
- Re: [XOM-interest] Put methods, jcowan, 02/05/2004
-
[XOM-interest] hasChildren vs. getChildCount == 0,
Elliotte Rusty Harold, 02/05/2004
-
Re: [XOM-interest] hasChildren vs. getChildCount == 0,
Dirk Bergstrom, 02/05/2004
- Re: [XOM-interest] hasChildren vs. getChildCount == 0, Bill de hÓra, 02/05/2004
- Re: [XOM-interest] hasChildren vs. getChildCount == 0, Janek Bogucki, 02/09/2004
-
Re: [XOM-interest] hasChildren vs. getChildCount == 0,
Dirk Bergstrom, 02/05/2004
- [XOM-interest] UNDECLARED vs. CDATA, Elliotte Rusty Harold, 02/05/2004
- [XOM-interest] Namespace methods, Elliotte Rusty Harold, 02/05/2004
- [XOM-interest] Builder issues, Elliotte Rusty Harold, 02/05/2004
- [XOM-interest] ID or identifier, Elliotte Rusty Harold, 02/05/2004
- [XOM-interest] NodeFactory issues, Elliotte Rusty Harold, 02/06/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Elliotte Rusty Harold, 02/06/2004
- Re: [XOM-interest] XOM 1.0d23 Last Call, Elliotte Rusty Harold, 02/11/2004
-
Re: [XOM-interest] XOM 1.0d23 Last Call,
John Cowan, 02/02/2004
Archive powered by MHonArc 2.6.24.