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: Tue, 24 Jan 2006 08:18:17 -0500

Steve Loughran wrote:

My particular need is this: I need to get a list of all currently
visible (prefix,namespace) tuples on an element so that I can then to
my own qname to element mapping, even after the node I was using has
been reparented.

OK. That's one I haven't heard before, and I can see that. In the early days when we were hashing out the exact namespace model for XOM, one of the things we considered was maintaining all namespaces in scope when an element was deleted, but that was just too ugly. For instance, when an element node is inserted at a new position in the tree, does it undeclare all prefixes inherited from its ancestors?

I tried to follow the principle of least surprise here based on my best guess of what most people would expect or want most of the time, but I'm afraid namespaces in XML are just too fundamentally weird to avoid surprising some of the people some of the time. Frankly if XOM can avoid surprising most of the people most of the time, it's doing really well. :-)

I can see that the grid spec you're referring to uses namespaces in element content, but I still don't have a full use case. Why do you need to move elements from one namespace scope to a different namespace scope? If you can explain that, you might convince me.

Two more questions:

1. When you move an element from point A to point B does this happen during a depth first search from the root to the element you're moving?

2. Do you just need all the namespaces when you detach, or do you also need them when you insert? This asks whether you allow a reinserted element to inherit namespaces from its new parent as well as its old. (Actually in XML 1.0 namespace prefixes can't be undeclared so the point is probably moot.)

--
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