Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Element. // Used for XPath and serialization Why is Element.getNamespacePrefixesInScope() private?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Steve Loughran <steve.loughran AT gmail.com>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Element. // Used for XPath and serialization Why is Element.getNamespacePrefixesInScope() private?
  • Date: Mon, 23 Jan 2006 12:43:26 -0500

Steve Loughran wrote:

Can I observe that the implementation of getNamespacePrefix(int) and
getNamespaceDeclarationCount() are both, well, aggressively suboptimal
as they create set structures that are discarded every run. That would
make enumerating all the namespaces an O(n*n) kind of process, rather
than the more simpler O(n) operation that would appear to be possible.

You may observe that, as it has been observed before. However without a convincing use case nothing's going to change. To avoid wasting time, the following use cases have been presented and do not convince me:

1. Anything involving binary encodings of XML
2. Anything involving replacing part of XOM
3. Anything involving an unfinished specification
4. Anything theoretical (i.e. just something you've thought of; not something you actually need to do.)

There may be use cases that don't get skewered by these rules. Also, use cases involving currently unfinished specifications may eventually become realistic, practical use cases in the future if not today.

However so far no one has presented any such cases that felt compelling. Until someone proves me wrong by presenting such a use case, I remain convinced that iterating over all the namespaces of an element, either in-scope or declared, is a very strange thing to want to do and far beyond the 80-20 point. Since it is possible to iterate over namespaces in XOM, I have no desire to complicate the API just to make it faster.

Again, this is all subject to change if you can present a convincing use case.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page