static void SortXmlAttributeCollection( XmlAttributeCollection col )
{
// Remove, sort, then re-add the attributes to the collection.
if (sort_attr && col != null && col.Count > 0) {
List<XmlAttribute> attrs = new List<XmlAttribute>(col.Count);
for (int i = col.Count - 1; i >= 0; i--) {
attrs.Add(col[i]);
col.RemoveAt(i);
}
SortAttributeList(attrs);
for (int i = 0; i < attrs.Count; i++) {
col.Append(attrs[i]);
}
}
}