Class CMXSDElementDeclaration

java.lang.Object
org.eclipse.lemminx.extensions.xsd.contentmodel.CMXSDElementDeclaration
All Implemented Interfaces:
CMElementDeclaration

public class CMXSDElementDeclaration extends Object implements CMElementDeclaration
XSD element declaration implementation.
  • Constructor Details

    • CMXSDElementDeclaration

      public CMXSDElementDeclaration(CMXSDDocument document, org.apache.xerces.xs.XSElementDeclaration elementDeclaration)
  • Method Details

    • refineType

      public CMXSDElementDeclaration refineType(org.apache.xerces.xs.XSTypeDefinition refinedType)
    • getLocalName

      public String getLocalName()
      Description copied from interface: CMElementDeclaration
      Returns the declared element local name.
      Specified by:
      getLocalName in interface CMElementDeclaration
      Returns:
      the declared element local name.
    • getNamespace

      public String getNamespace()
      Description copied from interface: CMElementDeclaration
      Returns the target namespace and null otherwise.
      Specified by:
      getNamespace in interface CMElementDeclaration
      Returns:
      the target namespace and null otherwise.
    • getPrefix

      public String getPrefix(String namespaceURI)
      Description copied from interface: CMElementDeclaration
      Returns the xmlns prefix from the given namespace URI and null otherwise.
      Specified by:
      getPrefix in interface CMElementDeclaration
      Parameters:
      namespaceURI - the namespace
      Returns:
      the xmlns prefix from the given namespace URI and null otherwise.
    • getTypeName

      public String getTypeName()
      Description copied from interface: CMElementDeclaration
      Returns the type name of the declared element (e.g., "xs:integer", "itemType") and null if not available.
      Specified by:
      getTypeName in interface CMElementDeclaration
      Returns:
      the type name and null otherwise.
    • getAttributes

      public Collection<CMAttributeDeclaration> getAttributes()
      Description copied from interface: CMElementDeclaration
      Returns the attributes of this declared element.
      Specified by:
      getAttributes in interface CMElementDeclaration
      Returns:
      the attributes element of this declared element.
    • getElements

      public Collection<CMElementDeclaration> getElements()
      Description copied from interface: CMElementDeclaration
      Returns the children declared element of this declared element.
      Specified by:
      getElements in interface CMElementDeclaration
      Returns:
      the children declared element of this declared element.
    • getPossibleElements

      public Collection<CMElementDeclaration> getPossibleElements(DOMElement parentElement, int offset)
      Description copied from interface: CMElementDeclaration
      Returns the possible declared elements at the given offset of the given parent element.
      Specified by:
      getPossibleElements in interface CMElementDeclaration
      Parameters:
      parentElement - the parent element
      offset - the offset
      Returns:
      the possible declared elements at the given offset of the given parent element.
    • isOptional

      public boolean isOptional(String childElementName)
      Description copied from interface: CMElementDeclaration
      Returns true if the child element name is optional and false otherwise.
      Specified by:
      isOptional in interface CMElementDeclaration
      Returns:
      true if the child element name is optional and false otherwise.
    • getContentElements

      public Collection<CMElementDeclaration> getContentElements()
      Description copied from interface: CMElementDeclaration
      Returns the children elements that form valid content for this element. Unlike CMElementDeclaration.getElements() which returns all possible children (including all choice alternatives), this method resolves choice groups by returning only the first alternative.
      Specified by:
      getContentElements in interface CMElementDeclaration
      Returns:
      the children elements for valid content.
    • getDocumentation

      public String getDocumentation(ISharedSettingsRequest request)
      Description copied from interface: CMElementDeclaration
      Returns formatted documentation of the declared element, according to settings defined in request.
      Specified by:
      getDocumentation in interface CMElementDeclaration
      Parameters:
      request - the request containing settings
      Returns:
      formatted documentation of the declared element, according to settings defined in request.
    • findCMElement

      public CMElementDeclaration findCMElement(String tag, String namespace)
      Description copied from interface: CMElementDeclaration
      Returns the declared element which matches the given XML tag name / namespace and null otherwise.
      Specified by:
      findCMElement in interface CMElementDeclaration
      Parameters:
      tag -
      namespace -
      Returns:
      the declared element which matches the given XML tag name / namespace and null otherwise.
    • findCMAttribute

      public CMAttributeDeclaration findCMAttribute(String attributeName, String namespace)
      Description copied from interface: CMElementDeclaration
      Returns the declared attribute which match the given name and null otherwise.
      Specified by:
      findCMAttribute in interface CMElementDeclaration
      Parameters:
      attributeName - the attribute name.
      namespace - the attribute namespace and null otherwise.
      Returns:
      the declared attribute which match the given name and null otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: CMElementDeclaration
      Returns true if the element cannot contains element children or text content and false otherwise.
      Specified by:
      isEmpty in interface CMElementDeclaration
      Returns:
      true if the element cannot contains element children or text content and false otherwise.
    • isNillable

      public boolean isNillable()
      Description copied from interface: CMElementDeclaration
      Returns true if the element can have an explicit null value assigned to it.
      Specified by:
      isNillable in interface CMElementDeclaration
      Returns:
      true if the element can have an explicit null value assigned to it.
    • getTypeAwareDefaultValue

      public String getTypeAwareDefaultValue()
      Description copied from interface: CMElementDeclaration
      Returns a type-aware default value suitable for document generation. For XSD elements, this returns type-inferred defaults (e.g., "0" for xs:integer, "2026-01-01" for xs:date). For other grammars, defaults to CMElementDeclaration.getDefaultValue().
      Specified by:
      getTypeAwareDefaultValue in interface CMElementDeclaration
      Returns:
      the type-aware default value, or null.
    • getEnumerationValues

      public Collection<String> getEnumerationValues()
      Description copied from interface: CMElementDeclaration
      Return the enumeration values.
      Specified by:
      getEnumerationValues in interface CMElementDeclaration
      Returns:
      the enumeration values.
    • getTextDocumentation

      public String getTextDocumentation(String textContent, ISharedSettingsRequest request)
      Description copied from interface: CMElementDeclaration
      Returns the documentation for the given enumeration value and null otherwise.
      Specified by:
      getTextDocumentation in interface CMElementDeclaration
      Parameters:
      textContent - the enumeration value.
      request - the shared settings.
      Returns:
      the documentation for the given enumeration value and null otherwise.
    • getDocumentURI

      public String getDocumentURI()
      Description copied from interface: CMElementDeclaration
      Returns the owner document URI where the element is declared.
      Specified by:
      getDocumentURI in interface CMElementDeclaration
      Returns:
      the owner document URI where the element is declared.
    • isStringType

      public boolean isStringType()
      Description copied from interface: CMElementDeclaration
      Returns true if the element is a string type (ex : xs:string) and false otherwise.
      Specified by:
      isStringType in interface CMElementDeclaration
      Returns:
      true if the element is a string type (ex : xs:string) and false otherwise.
    • isMixedContent

      public boolean isMixedContent()
      Description copied from interface: CMElementDeclaration
      Returns true if the element can contains text and element both and false otherwise.
      Specified by:
      isMixedContent in interface CMElementDeclaration
      Returns:
      true if the element can contains text and element both and false otherwise.
    • getDerivedTypeNames

      public Collection<String> getDerivedTypeNames()
      Description copied from interface: CMElementDeclaration
      Returns the local names of types derived from this element's declared type. Used to generate xsi:type snippet choices when the element's type is abstract and cannot be instantiated directly.
      Specified by:
      getDerivedTypeNames in interface CMElementDeclaration
      Returns:
      the collection of derived type local names, or empty if the type is not abstract or has no derived types.
    • getRequiredElements

      public Set<CMElementDeclaration> getRequiredElements()
      Description copied from interface: CMElementDeclaration
      Returns a list of required/non-optional child elements of the current element.
      Specified by:
      getRequiredElements in interface CMElementDeclaration
      Returns:
      a list of required/non-optional child elements of the current element.