Interface CMElementDeclaration

All Known Implementing Classes:
CMDTDElementDeclaration, CMRelaxNGElementDeclaration, CMXSDElementDeclaration

public interface CMElementDeclaration
Content model element which abstracts element declaration from a given grammar (XML Schema, DTD).
  • Field Details

  • Method Details

    • getLocalName

      String getLocalName()
      Returns the declared element local name.
      Returns:
      the declared element local name.
    • getNamespace

      String getNamespace()
      Returns the target namespace and null otherwise.
      Returns:
      the target namespace and null otherwise.
    • getPrefix

      String getPrefix(String namespaceURI)
      Returns the xmlns prefix from the given namespace URI and null otherwise.
      Parameters:
      namespaceURI - the namespace
      Returns:
      the xmlns prefix from the given namespace URI and null otherwise.
    • getName

      default String getName(String prefix)
      Returns the declared element name with the given prefix.
      Returns:
      the declared element name with the given prefix.
    • getAttributes

      Returns the attributes of this declared element.
      Returns:
      the attributes element of this declared element.
    • getPossibleAttributes

      default Collection<CMAttributeDeclaration> getPossibleAttributes(DOMElement parentElement)
      Returns the possible attributes for the given parent element, taking into account already-specified attributes to narrow choices (e.g. in RelaxNG choice groups).
      Parameters:
      parentElement - the DOM element being edited.
      Returns:
      the possible attribute declarations.
    • getElements

      Returns the children declared element of this declared element.
      Returns:
      the children declared element of this declared element.
    • getContentElements

      default Collection<CMElementDeclaration> getContentElements()
      Returns the children elements that form valid content for this element. Unlike getElements() which returns all possible children (including all choice alternatives), this method resolves choice groups by returning only the first alternative.
      Returns:
      the children elements for valid content.
    • getPossibleElements

      Collection<CMElementDeclaration> getPossibleElements(DOMElement parentElement, int offset)
      Returns the possible declared elements at the given offset of the given parent element.
      Parameters:
      parentElement - the parent element
      offset - the offset
      Returns:
      the possible declared elements at the given offset of the given parent element.
    • findCMElement

      CMElementDeclaration findCMElement(String tag, String namespace)
      Returns the declared element which matches the given XML tag name / namespace and null otherwise.
      Parameters:
      tag -
      namespace -
      Returns:
      the declared element which matches the given XML tag name / namespace and null otherwise.
    • findCMAttribute

      default CMAttributeDeclaration findCMAttribute(DOMAttr attr)
      Returns the declared attribute which match the given name and null otherwise.
      Parameters:
      attribute - the DOM attribute
      Returns:
      the declared attribute which match the given name and null otherwise.
    • findCMAttribute

      CMAttributeDeclaration findCMAttribute(String attributeName, String namespace)
      Returns the declared attribute which match the given name and null otherwise.
      Parameters:
      attributeName - the attribute name.
      namespace - the attribute namespace and null otherwise.
      Returns:
      the declared attribute which match the given name and null otherwise.
    • getDocumentation

      String getDocumentation(ISharedSettingsRequest request)
      Returns formatted documentation of the declared element, according to settings defined in request.
      Parameters:
      request - the request containing settings
      Returns:
      formatted documentation of the declared element, according to settings defined in request.
    • isEmpty

      boolean isEmpty()
      Returns true if the element cannot contains element children or text content and false otherwise.
      Returns:
      true if the element cannot contains element children or text content and false otherwise.
    • isNillable

      boolean isNillable()
      Returns true if the element can have an explicit null value assigned to it.
      Returns:
      true if the element can have an explicit null value assigned to it.
    • getDefaultValue

      default String getDefaultValue()
      Returns the explicit default value from the schema declaration, or null if none is declared. Does NOT include type-inferred defaults.
      Returns:
      the explicit default value, or null.
    • getTypeAwareDefaultValue

      default String getTypeAwareDefaultValue()
      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 getDefaultValue().
      Returns:
      the type-aware default value, or null.
    • getTypeName

      default String getTypeName()
      Returns the type name of the declared element (e.g., "xs:integer", "itemType") and null if not available.
      Returns:
      the type name and null otherwise.
    • getEnumerationValues

      Collection<String> getEnumerationValues()
      Return the enumeration values.
      Returns:
      the enumeration values.
    • getTextDocumentation

      String getTextDocumentation(String value, ISharedSettingsRequest request)
      Returns the documentation for the given enumeration value and null otherwise.
      Parameters:
      value - the enumeration value.
      request - the shared settings.
      Returns:
      the documentation for the given enumeration value and null otherwise.
    • getDocumentURI

      String getDocumentURI()
      Returns the owner document URI where the element is declared.
      Returns:
      the owner document URI where the element is declared.
    • isStringType

      boolean isStringType()
      Returns true if the element is a string type (ex : xs:string) and false otherwise.
      Returns:
      true if the element is a string type (ex : xs:string) and false otherwise.
    • isMixedContent

      boolean isMixedContent()
      Returns true if the element can contains text and element both and false otherwise.
      Returns:
      true if the element can contains text and element both and false otherwise.
    • isOptional

      boolean isOptional(String childElementName)
      Returns true if the child element name is optional and false otherwise.
      Returns:
      true if the child element name is optional and false otherwise.
    • getRequiredElements

      Collection<CMElementDeclaration> getRequiredElements()
      Returns a list of required/non-optional child elements of the current element.
      Returns:
      a list of required/non-optional child elements of the current element.
    • getDerivedTypeNames

      default Collection<String> getDerivedTypeNames()
      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.
      Returns:
      the collection of derived type local names, or empty if the type is not abstract or has no derived types.