Package org.eclipse.lemminx.extensions.contentmodel.model

## 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 Summary

Fields
`static Collection<CMElementDeclaration>` `ANY_ELEMENT_DECLARATIONS`

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`CMAttributeDeclaration` `findCMAttribute​(String attributeName, String namespace)` Returns the declared attribute which match the given name and null otherwise.
`default CMAttributeDeclaration` `findCMAttribute​(DOMAttr attr)` Returns the declared attribute which match the given name and null otherwise.
`CMElementDeclaration` `findCMElement​(String tag, String namespace)` Returns the declared element which matches the given XML tag name / namespace and null otherwise.
`Collection<CMAttributeDeclaration>` `getAttributes()` Returns the attributes of this declared element.
`String` `getDocumentation​(ISharedSettingsRequest request)` Returns formatted documentation of the declared element, according to settings defined in `request`.
`String` `getDocumentURI()` Returns the owner document URI where the element is declared.
`Collection<CMElementDeclaration>` `getElements()` Returns the children declared element of this declared element.
`Collection<String>` `getEnumerationValues()` Return the enumeration values.
`String` `getLocalName()` Returns the declared element local name.
`default String` `getName​(String prefix)` Returns the declared element name with the given prefix.
`String` `getNamespace()` Returns the target namespace and null otherwise.
`Collection<CMElementDeclaration>` `getPossibleElements​(DOMElement parentElement, int offset)` Returns the possible declared elements at the given offset of the given parent element.
`String` `getPrefix​(String namespaceURI)` Returns the xmlns prefix from the given namespace URI and null otherwise.
`Collection<CMElementDeclaration>` `getRequiredElements()` Returns a list of required/non-optional child elements of the current element.
`String` `getTextDocumentation​(String value, ISharedSettingsRequest request)` Returns the documentation for the given enumeration value and null otherwise.
`boolean` `isEmpty()` Returns true if the element cannot contains element children or text content and false otherwise.
`boolean` `isMixedContent()` Returns true if the element can contains text and element both and false otherwise.
`boolean` `isNillable()` Returns true if the element can have an explicit null value assigned to it.
`boolean` `isOptional​(String childElementName)` Returns true if the child element name is optional and false otherwise.
`boolean` `isStringType()` Returns true if the element is a string type (ex : xs:string) and false otherwise.

### Field Detail

#### ANY_ELEMENT_DECLARATIONS

    static final Collection<CMElementDeclaration> ANY_ELEMENT_DECLARATIONS

### Method Detail

#### 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

    Collection<CMAttributeDeclaration> getAttributes()

Returns the attributes of this declared element.

Returns:
  the attributes element of this declared element.

#### getElements

    Collection<CMElementDeclaration> getElements()

Returns the children declared element of this declared element.

Returns:
  the children declared element of this declared element.

#### 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.

#### 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.