Class RNCDatatypeLibrary
java.lang.Object
org.eclipse.lemminx.extensions.relaxng.grammar.rnc.RNCDatatypeLibrary
Registry of datatype libraries available in RNC documents.
A datatype library maps a URI (declared via datatypes prefix = "uri")
to a set of named data types, each with documentation. This class is used by
both completion (to propose types like xsd:integer) and hover (to show
documentation when the cursor is on a type reference).
Libraries are loaded from the bundled rnc-datatype-libraries.json
resource, which defines three libraries matching Jing's architecture:
- Built-in (empty URI):
string,token - Compatibility (
http://relaxng.org/ns/compatibility/datatypes/1.0):ID,IDREF,IDREFS - XSD (
http://www.w3.org/2001/XMLSchema-datatypes): all W3C XML Schema built-in datatypes
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA single datatype entry within a library, holding its name and documentation in both Markdown and plain text formats. -
Method Summary
Modifier and TypeMethodDescriptionstatic RNCDatatypeLibraryReturns the datatype library for the given URI, ornullif unknown.Returns the conventional prefix for this library, used to generatedatatypessnippets (e.g.Returns a human-readable description of this library.Returns all datatype entries in this library.Returns the entry for the given datatype name, ornullif not found.static Collection<RNCDatatypeLibrary> Returns all registered datatype libraries.getUri()Returns the library URI (e.g.static RNCDatatypeLibraryresolve(RNCDocument document, String prefix) Resolves a datatype prefix to its library by looking up thedatatypesdeclarations in the given RNC document.
-
Method Details
-
getUri
Returns the library URI (e.g."http://www.w3.org/2001/XMLSchema-datatypes").- Returns:
- the URI string, or empty string for the built-in library.
-
getDescription
Returns a human-readable description of this library.- Returns:
- the description (e.g.
"W3C XML Schema datatypes").
-
getDefaultPrefix
Returns the conventional prefix for this library, used to generatedatatypessnippets (e.g."xsd","compat").- Returns:
- the default prefix, or
nullfor the built-in library.
-
getEntries
Returns all datatype entries in this library.- Returns:
- the entries (e.g.
string,integer,ID).
-
getEntry
Returns the entry for the given datatype name, ornullif not found.- Parameters:
name- the datatype name (e.g."integer","ID").- Returns:
- the matching entry, or
null.
-
get
Returns the datatype library for the given URI, ornullif unknown. -
getLibraries
Returns all registered datatype libraries. -
resolve
Resolves a datatype prefix to its library by looking up thedatatypesdeclarations in the given RNC document.- Returns:
- the library, or
nullif the prefix is not declared or maps to an unknown library.
-