} // normalize(String):String
/** Returns a sorted list of attributes. */
protected Attributes sortAttributes(Attributes attrs) {
AttributesImpl attributes = new AttributesImpl();
int len = (attrs != null) ? attrs.getLength() : 0;
for (int i = 0; i < len; i++) {
String name = attrs.getQName(i);
int count = attributes.getLength();
int j = 0;
while (j < count) {
if (name.compareTo(attributes.getQName(j)) < 0) {
break;
}
j++;
}
attributes.insertAttributeAt(j, name, attrs.getType(i),
attrs.getValue(i));
}
return attributes;