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