Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Scope of namespaces

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: peter murray-rust <pm286 AT cam.ac.uk>
  • To: Elliotte Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Scope of namespaces
  • Date: Mon, 06 Feb 2006 19:39:09 +0000

At 13:13 06/02/2006, Elliotte Harold wrote:
peter murray-rust wrote:

Many thanks for all the useful feedback.

Personally as a user of XOM I would find it much easier if all namespaces were easily available in all their descendant elements.

You can get a list of the namespaces in scope on an element using an XPath query such as

Nodes namespaces = element.query("namespace::node()");

I think this will do what I want.

At the risk of appearing foolish, I'll outline my reason for using this construct. When I saw "xsd:double" etc. in XSD I assumed this was a useful extension of XML. Also, because QName was a defined dataType in XSD I assumed this was a Good Thing To Do.

I have a need to access (remote) objects by their ids, and as I cannot guarantee that they are unique across the planet (our community is too anarchic) I assume they are locally unique within a file (document) identified by a namespace. Thus:
<scalar xmlns:foo="http://foo"; dictRef="foo:abc">1.23</scalar>
points to the object with id="abc" within a namespace of http://foo. This allows any document creator to identify a document with a namespace (unrelated to the namespace on the elements). So there are times when I need to compare a namespace with the namespaces in scope in the document.

Recent discussion suggests that namespaced attribute and content values are considered harmful. It is possible to construct a system which does the same independently of XML machinery but it is more work and I thought I was gaining something from XML that helped.

P.


Peter Murray-Rust
Unilever Centre for Molecular Sciences Informatics
University of Cambridge,
Lensfield Road, Cambridge CB2 1EW, UK
+44-1223-763069




Archive powered by MHonArc 2.6.24.

Top of Page