Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Higher level namespace declarations for compactness

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 AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Higher level namespace declarations for compactness
  • Date: Sun, 24 Sep 2006 11:39:40 +0100

I have a related problem - please excuse me if the answer is obvious.

I wish to be able to change the namespace prefixes on elements if there is a conflict. As I understand it the namespace prefix on elements and attributes has no intrinsic meaning other than when the nodes are serialized. The NS_URI contains all the non-lexical information about the node().

However when creating an element with a non-default namespace the name must have a hardcoded prefix at construction-time. For example from the tutorial

String namespace = "http://www.w3.org/1998/Math/MathML";;
Element root = new Element("mathml:math", namespace);

If I wish to serialize the output of this the elements will have the mathml prefix and I cannot see a simple way of avoiding this. The problem might come when I have a factory which creates elements with a given prefix and a second library that uses the same prefix for a different namespace. Even though I suspect that the output differentiates between them it will extremely confusing to have the same prefix for different namespaces.

I am not clear why the element prefixes have to be hardcoded other than for serialization. The only workaround I can think of is to copy the nodes and change the prefixes.

P.

http://lists.ibiblio.org/mailman/listinfo/xom-interest

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