Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Element.addNamespaceDeclaration ?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Element.addNamespaceDeclaration ?
  • Date: Sat, 12 Feb 2005 09:55:22 -0800

I'm not quite sure, but perhaps it's possibly to avoid allocating unnecessary memory in Element.addNamespaceDeclaration() when there is already an attribute with the same binding. In this case, couldn't we return without putting the binding into the namespace map? Along the following lines:

Element.addNamespaceDeclaration(...)
...
String currentBinding = getLocalNamespaceURI(prefix);
// if (currentBinding != null && !currentBinding.equals(uri)) {
if (currentBinding != null) {
if (currentBinding.equals(uri)) return; // WH: nothing do do ???
throw new NamespaceConflictException(
"Additional namespace " + uri
+ " conflicts with existing namespace binding."
);
}

if (namespaces == null) namespaces = new Namespaces();
namespaces.put(prefix, uri);


What am I missing?





Archive powered by MHonArc 2.6.24.

Top of Page