Skip to content

Commit

Permalink
XML attribute associated to wrong type from XSD
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr committed Feb 15, 2023
1 parent 5cf4a9c commit 9234b37
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ public static Range selectAttributeValueFromGivenValue(String attrValue, int off
DOMNode element = document.findNodeAt(offset);
if (element != null && element.hasAttributes()) {
List<DOMAttr> attribues = element.getAttributeNodes();
for (DOMAttr attr : attribues) {
if (attrValue.equals(attr.getValue())) {
for (int i = attribues.size() - 1; i >= 0; i--) {
DOMAttr attr = attribues.get(i);
if (offset > attr.getStart() && attrValue.equals(attr.getValue())) {
return createAttrValueRange(attr, document);
}
}
Expand Down Expand Up @@ -1151,22 +1152,22 @@ public static Position getMatchingTagPosition(DOMDocument xmlDocument, Position

/**
* Select the value from the start/end node without quote.
*
*
* For the given attr value:
*
*
* <p>
* <element attr="value" />
* </p>
*
*
* it will return <element attr="|value|" /> range without ".
*
*
* @param node the DOM node.
*
*
* @return the value from the start/end node without quote.
*/
public static Range selectValueWithoutQuote(DOMRange node) {
DOMDocument document = node.getOwnerDocument();
return createRange(node.getStart() + 1, node.getEnd() - 1, document);
}

}
}

0 comments on commit 9234b37

Please sign in to comment.