Skip to content

Commit

Permalink
Merge 7a203fa into ffefb79
Browse files Browse the repository at this point in the history
  • Loading branch information
CarthageKing committed Dec 3, 2016
2 parents ffefb79 + 7a203fa commit 5fb8e7e
Show file tree
Hide file tree
Showing 3 changed files with 358 additions and 322 deletions.
Expand Up @@ -3,6 +3,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import javax.xml.parsers.DocumentBuilder;
Expand Down Expand Up @@ -289,7 +292,16 @@ private void parseChildren(String path, org.w3c.dom.Element node, Element contex
}

private Property getElementProp(List<Property> properties, String nodeName) {
for (Property p : properties)
List<Property> propsSortedByLongestFirst = new ArrayList<Property>(properties);
// sort properties according to their name longest first, so .requestOrganizationReference comes first before .request[x]
// and therefore the longer property names get evaluated first
Collections.sort(propsSortedByLongestFirst, new Comparator<Property>() {
@Override
public int compare(Property o1, Property o2) {
return o2.getName().length() - o1.getName().length();
}
});
for (Property p : propsSortedByLongestFirst)
if (!p.getDefinition().hasRepresentation(PropertyRepresentation.XMLATTR) && !p.getDefinition().hasRepresentation(PropertyRepresentation.XMLTEXT)) {
if (p.getName().equals(nodeName))
return p;
Expand Down

0 comments on commit 5fb8e7e

Please sign in to comment.