Class RNCDatatypesDecl
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCDatatypesDecl
- All Implemented Interfaces:
RNCRange
Represents a
datatypes declaration in an RNC document.
A datatypes declaration binds a prefix to a datatypes library URI, allowing the prefix to be used to reference specific data types from that library.
Use case: the parser creates an RNCDatatypesDecl node when it
encounters the datatypes keyword. Completion uses it to offer
well-known datatype URIs; semantic tokens classify the prefix as a
namespace token.
Example RNC:
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
root = element root {
attribute id { xsd:ID } ← uses "xsd" prefix declared above
}
-
Constructor Summary
ConstructorsConstructorDescriptionRNCDatatypesDecl(int start, int end) Creates a new datatypes declaration node spanning the given offsets. -
Method Summary
Modifier and TypeMethodDescriptionReturns the datatypes prefix extracted from the source text.intReturns the exclusive end offset of the prefix.intReturns the inclusive start offset of the prefix.getUri()Returns the datatypes library URI with surrounding quotes stripped.intReturns the exclusive end offset of the URI literal.intReturns the inclusive start offset of the URI literal.voidsetPrefix(int start, int end) Sets the source offsets of the datatypes prefix.voidsetUri(int start, int end) Sets the source offsets of the URI literal.Methods inherited from class org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCNode
addChild, findNodeAt, getChildren, getEnd, getOwnerDocument, getParent, getStart, getText, hasChildren, isClosed, setClosed, setEnd, setStart
-
Constructor Details
-
RNCDatatypesDecl
public RNCDatatypesDecl(int start, int end) Creates a new datatypes declaration node spanning the given offsets.- Parameters:
start- the inclusive start offset.end- the exclusive end offset.
-
-
Method Details
-
getNodeType
- Specified by:
getNodeTypein classRNCNode
-
setPrefix
public void setPrefix(int start, int end) Sets the source offsets of the datatypes prefix.- Parameters:
start- the inclusive start offset of the prefix.end- the exclusive end offset of the prefix.
-
getPrefix
Returns the datatypes prefix extracted from the source text.Example: for
datatypes xsd = "http://...", returns"xsd".- Returns:
- the prefix string, or
nullif not set.
-
getPrefixStart
public int getPrefixStart()Returns the inclusive start offset of the prefix.- Returns:
- the prefix start offset, or
-1if not set.
-
getPrefixEnd
public int getPrefixEnd()Returns the exclusive end offset of the prefix.- Returns:
- the prefix end offset, or
-1if not set.
-
setUri
public void setUri(int start, int end) Sets the source offsets of the URI literal.- Parameters:
start- the inclusive start offset (including the opening quote).end- the exclusive end offset (after the closing quote).
-
getUri
Returns the datatypes library URI with surrounding quotes stripped.Example: for
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes", returns"http://www.w3.org/2001/XMLSchema-datatypes".- Returns:
- the URI string without quotes, or
nullif not set.
-
getUriStart
public int getUriStart()Returns the inclusive start offset of the URI literal.- Returns:
- the URI start offset, or
-1if not set.
-
getUriEnd
public int getUriEnd()Returns the exclusive end offset of the URI literal.- Returns:
- the URI end offset, or
-1if not set.
-