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

public class RNCDatatypesDecl extends RNCNode
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 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

      public RNCNodeType getNodeType()
      Specified by:
      getNodeType in class RNCNode
    • 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

      public String getPrefix()
      Returns the datatypes prefix extracted from the source text.

      Example: for datatypes xsd = "http://...", returns "xsd".

      Returns:
      the prefix string, or null if not set.
    • getPrefixStart

      public int getPrefixStart()
      Returns the inclusive start offset of the prefix.
      Returns:
      the prefix start offset, or -1 if not set.
    • getPrefixEnd

      public int getPrefixEnd()
      Returns the exclusive end offset of the prefix.
      Returns:
      the prefix end offset, or -1 if 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

      public String 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 null if not set.
    • getUriStart

      public int getUriStart()
      Returns the inclusive start offset of the URI literal.
      Returns:
      the URI start offset, or -1 if not set.
    • getUriEnd

      public int getUriEnd()
      Returns the exclusive end offset of the URI literal.
      Returns:
      the URI end offset, or -1 if not set.