Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Attributes performance patch

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: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Attributes performance patch
  • Date: Mon, 22 Nov 2004 15:55:39 -0500

Wolfgang Hoschek wrote:

On Nov 22, 2004, at 3:07 AM, Elliotte Harold wrote:

A fix is in CVS. Thanks for the report.


Attributes copy() {

Attributes result = new Attributes();
int size = attributes.size();
result.attributes.ensureCapacity(size);
for (int i = 0; i < size(); i++) {
result.attributes.add(this.get(i).copy());
}
return result;

}

should better read:

Attributes copy() {

Attributes result = new Attributes();
int size = attributes.size();
result.attributes.ensureCapacity(size);
for (int i = 0; i < size; i++) { // WH DELTA HERE
result.attributes.add(this.get(i).copy());
}
return result;

}

Despite your comment, I had to look at this three times before I noticed what had changed; but I see it now. Fixed.


and as stated and documented in my previous mail there is no need to loop any further, hence

void checkPrefixConflict(Attribute attribute) {

String prefix = attribute.getNamespacePrefix();
String namespaceURI = attribute.getNamespaceURI();

// Look for conflicts
int size = this.size();
for (int i = 0; i < size; i++) {
Attribute a = (Attribute) attributes.get(i);
if (a.getNamespacePrefix().equals(prefix)
&& !(a.getNamespaceURI().equals(namespaceURI))) {
throw new NamespaceConflictException(
"Prefix of " + attribute.getQualifiedName()
+ " conflicts with " + a.getQualifiedName());
}
}

}


Also fixed.

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