@Nullable
protected Comparator<AbstractDomElementNode> getDefaultComparator(DomElement element) {
final XmlTag tag = element.getXmlTag();
if (tag != null) {
final XmlElementDescriptor descriptor = tag.getDescriptor();
if (descriptor != null) {
final XmlElementDescriptor[] childDescriptors = descriptor.getElementsDescriptors(tag);
if (childDescriptors != null && childDescriptors.length > 1) {
return new Comparator<AbstractDomElementNode>() {
public int compare(final AbstractDomElementNode o1, final AbstractDomElementNode o2) {
return findDescriptor(childDescriptors, o1.getTagName()) - findDescriptor(childDescriptors, o2.getTagName());
}