Skip to Content.
Sympa Menu

xom-interest - [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: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] Scope of namespaces
  • Date: Sun, 05 Feb 2006 17:37:44 +0000

[Please excuse me if this has been discussed before and is an FAQ]

I make frequent use of constructs such as

<cml xmlns="http://www.xml-cml.or/schema";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<scalar dataType="xsd:double">1.23</scalar>
</cml>

where attribute values are effectively QNames. The namespace spec (http://www.w3.org/TR/REC-xml-names/) states (5.1) that:
"The namespace declaration is considered to apply to the element where it is specified and to all elements within the content of that element".
I therefore assumed that in the example the xsd namespaceURI (http://www.w3.org/2001/XMLSchema) is in scope for the dataType attribute. However the XOM documentation implies that the namespace is not in scope and that the implementer has to explore the ancestry every time to determine what namespaces are actually in scope. A possible solution is to cache the namespace on the appropriate elements but this could be fragile as it could break if elements are detached or moved.

Is the XOM interpretation consistent with the spec and other DOM implementations?

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

Thanks

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