public class XMLPositionUtility extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
covers(org.eclipse.lsp4j.Range range,
org.eclipse.lsp4j.Position position) |
static org.eclipse.lsp4j.Location |
createLocation(DOMRange target)
Returns the location for the given
target node. |
static org.eclipse.lsp4j.LocationLink |
createLocationLink(DOMRange origin,
DOMRange target)
Returns the location link for the given
origin and
target nodes. |
static org.eclipse.lsp4j.Range |
createRange(DOMRange range)
Returns the range for the given
node . |
static org.eclipse.lsp4j.Range |
createRange(int startOffset,
int endOffset,
DOMDocument document) |
static boolean |
doesTagCoverPosition(org.eclipse.lsp4j.Range startTagRange,
org.eclipse.lsp4j.Range endTagRange,
org.eclipse.lsp4j.Position position) |
static DOMNode |
findUnclosedChildNode(List<DOMNode> children) |
static org.eclipse.lsp4j.Range |
getElementDeclMissingContentOrCategory(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
getLastDTDDeclParameter(int offset,
DOMDocument document)
Will give the range for the last DTD Decl parameter at 'offset'.
|
static org.eclipse.lsp4j.Range |
getLastValidDTDDeclParameter(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
getLastValidDTDDeclParameter(int offset,
DOMDocument document,
boolean selectWholeParameter)
Will give the range for the last VALID DTD Decl parameter at 'offset'.
|
static org.eclipse.lsp4j.Range |
getLastValidDTDDeclParameterOrUnrecognized(int offset,
DOMDocument document)
Will give the range for the last VALID DTD Decl parameter at 'offset'.
|
static org.eclipse.lsp4j.Position |
getMatchingTagPosition(DOMDocument xmlDocument,
org.eclipse.lsp4j.Position position) |
static org.eclipse.lsp4j.Range |
getTagNameRange(TokenType tokenType,
int startOffset,
DOMDocument xmlDocument) |
static boolean |
isBeforeOrEqual(org.eclipse.lsp4j.Position pos1,
org.eclipse.lsp4j.Position pos2) |
static org.eclipse.lsp4j.Range |
selectAllAttributes(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributeFromGivenNameAt(String attrName,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributeNameAt(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributeNameFromGivenNameAt(String attrName,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributePrefixFromGivenNameAt(String attrName,
int offset,
DOMDocument document)
Returns the range of the prefix of an attribute name
For example, if attrName = "xsi:example", the range for "xsi" will be
returned
|
static org.eclipse.lsp4j.Range |
selectAttributeValueAt(String attrName,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributeValueByGivenValueAt(String attrValue,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectAttributeValueFromGivenValue(String attrValue,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectChildEndTag(String childTag,
int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectContent(int offset,
DOMDocument document) |
static int |
selectCurrentTagOffset(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectDTDDeclTagNameAt(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectDTDElementDeclAt(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectEndTagLocalName(DOMElement element)
Returns the range of the end tag of the given LOCAL
element name and null
otherwise. |
static org.eclipse.lsp4j.Range |
selectEndTagName(DOMElement element)
Returns the range of the end tag of the given
element name and null
otherwise. |
static org.eclipse.lsp4j.Range |
selectEndTagName(DOMElement element,
boolean localNameOnly)
Returns the range of the end tag of the given
element and null
otherwise. |
static org.eclipse.lsp4j.Range |
selectEndTagName(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectFirstChild(int offset,
DOMDocument document)
Returns the range covering the first child of the node located
at offset.
|
static org.eclipse.lsp4j.Range |
selectFirstNonWhitespaceText(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectPreviousNodesEndTag(int offset,
DOMDocument document)
Finds the offset of the first tag it comes across behind the given offset.
|
static org.eclipse.lsp4j.Range |
selectRootStartTag(DOMDocument document)
Returns the range of the root start tag (excludes the '<') of the given
document and null otherwise. |
static org.eclipse.lsp4j.Range |
selectStartTagLocalName(DOMNode element)
Returns the range of a tag's local name.
|
static org.eclipse.lsp4j.Range |
selectStartTagName(DOMNode element)
Returns the range of the start tag name (excludes the '<') of the given
element and null
otherwise. |
static org.eclipse.lsp4j.Range |
selectStartTagName(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Range |
selectTrimmedText(int offset,
DOMDocument document)
Returns the range covering the trimmed text belonging to the node
located at offset.
|
static org.eclipse.lsp4j.Range |
selectWholeTag(int offset,
DOMDocument document) |
static org.eclipse.lsp4j.Location |
toLocation(org.eclipse.lsp4j.LocationLink locationLink) |
static org.eclipse.lsp4j.Position |
toLSPPosition(int offset,
org.apache.xerces.xni.XMLLocator location,
TextDocument document)
Returns the LSP position from the SAX location.
|
public static org.eclipse.lsp4j.Position toLSPPosition(int offset, org.apache.xerces.xni.XMLLocator location, TextDocument document)
offset
- the adjusted offset.location
- the original SAX location.document
- the text document.public static org.eclipse.lsp4j.Range selectAttributeNameAt(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributeValueAt(String attrName, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributeValueFromGivenValue(String attrValue, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributeValueByGivenValueAt(String attrValue, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributeNameFromGivenNameAt(String attrName, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributePrefixFromGivenNameAt(String attrName, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectAttributeFromGivenNameAt(String attrName, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectChildEndTag(String childTag, int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectRootStartTag(DOMDocument document)
document
and null otherwise.document
- the DOM document.document
and null otherwise.public static org.eclipse.lsp4j.Range selectStartTagName(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectStartTagName(DOMNode element)
element
and null
otherwise.element
- the DOM elementelement
and null
otherwise.public static org.eclipse.lsp4j.Range selectStartTagLocalName(DOMNode element)
element
- public static int selectCurrentTagOffset(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectEndTagName(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectEndTagName(DOMElement element)
element
name and null
otherwise.element
- the DOM elementelement
and null
otherwise.public static org.eclipse.lsp4j.Range selectEndTagLocalName(DOMElement element)
element
name and null
otherwise.element
- the DOM elementelement
and null
otherwise.public static org.eclipse.lsp4j.Range selectEndTagName(DOMElement element, boolean localNameOnly)
element
and null
otherwise.element
- the DOM elementelement
and null
otherwise.public static org.eclipse.lsp4j.Range selectAllAttributes(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectFirstNonWhitespaceText(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectPreviousNodesEndTag(int offset, DOMDocument document)
This will include the tag it starts in if the offset is within a tag's content:
<a> <b> | </b> </a>
, will give </b>
<a> <b> </b> </a| <c>
, will give </a>
<a> <b|> </b> </a>
, will give </a>
public static org.eclipse.lsp4j.Range createRange(DOMRange range)
node
.node
- the nodenode
.public static org.eclipse.lsp4j.Range createRange(int startOffset, int endOffset, DOMDocument document)
public static org.eclipse.lsp4j.LocationLink createLocationLink(DOMRange origin, DOMRange target)
origin
and
target
nodes.origin
- the origin node.target
- the target node.origin
and
target
nodes.public static org.eclipse.lsp4j.Location createLocation(DOMRange target)
target
node.target
- the target node.target
node.public static org.eclipse.lsp4j.Range selectFirstChild(int offset, DOMDocument document)
offset
- document
- public static org.eclipse.lsp4j.Range selectContent(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectTrimmedText(int offset, DOMDocument document)
offset
- document
- public static org.eclipse.lsp4j.Range selectDTDElementDeclAt(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range getLastValidDTDDeclParameter(int offset, DOMDocument document, boolean selectWholeParameter)
public static org.eclipse.lsp4j.Range getLastValidDTDDeclParameter(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range getLastValidDTDDeclParameterOrUnrecognized(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range getLastDTDDeclParameter(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectDTDDeclTagNameAt(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range selectWholeTag(int offset, DOMDocument document)
public static org.eclipse.lsp4j.Range getElementDeclMissingContentOrCategory(int offset, DOMDocument document)
public static boolean doesTagCoverPosition(org.eclipse.lsp4j.Range startTagRange, org.eclipse.lsp4j.Range endTagRange, org.eclipse.lsp4j.Position position)
public static boolean covers(org.eclipse.lsp4j.Range range, org.eclipse.lsp4j.Position position)
public static boolean isBeforeOrEqual(org.eclipse.lsp4j.Position pos1, org.eclipse.lsp4j.Position pos2)
public static org.eclipse.lsp4j.Range getTagNameRange(TokenType tokenType, int startOffset, DOMDocument xmlDocument)
public static org.eclipse.lsp4j.Location toLocation(org.eclipse.lsp4j.LocationLink locationLink)
public static org.eclipse.lsp4j.Position getMatchingTagPosition(DOMDocument xmlDocument, org.eclipse.lsp4j.Position position)
Copyright © 2020. All rights reserved.