Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Remarks on 1.0d8 API

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Laurent Bihanic <laurent.bihanic AT atosorigin.com>
  • To: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • Cc: XOM-interest <XOM-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Remarks on 1.0d8 API
  • Date: Tue, 21 Jan 2003 17:00:57 +0100

Elliotte Rusty Harold wrote:
At 7:26 PM +0100 1/15/03, Laurent Bihanic wrote:
What bothers me more here is the behaviour of the methods getNamespaceDeclarationCount() and getNamespacePrefix(): they do not give access to the element and attributes namespaces.

I've thought about that. However, the real question is whether these methods should return namespaces in scope or namespaces declared. If it's namespaces in scope, then they need to return ancestor declared namespaces as well the attributes' and element's own namespaces. If it's namespaces declared, it may not include the attributes' and element's own namespaces, depending on whether those namespaces have previously been declared on some ancestor. Right now XOM is in the middle between those two.

I'm really not use what to do. Use-cases might help. Srrialization is the big one. What other use-cases are there, if any, for iterating through all of an element's namespaces? either declared or in-scope or additional?

What I wanted to say is that I'm fine with the current behavior of getNamespaceDeclarationCount() and getNamespacePrefix() provided I can retrieve *any* namespace that was accepted by declareNamespace().

So, there is a choice either to throw a NamespaceException for any attempt to redeclare the namespace of the element or one of its attributes and not change getNamespaceDeclarationCount() and getNamespacePrefix() or to silently accept/ignore namespace redeclarations but change getNamespaceDeclarationCount() and getNamespacePrefix() to allow iterating on *all* the namespaces declared at the element level (element namespace, attribute namespaces and additional namespaces)

One last question: There is no getNamespacePrefix(String uri) method. Wouldn't it be useful? What do I do if I want to add an attribute in a given namespace and would like to "reuse" any namespace declaration for the same URI present higher up in the document to avoid duplicating declarations for the same URI ?

Laurent





Archive powered by MHonArc 2.6.24.

Top of Page