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 -
Method Summary
Modifier and TypeMethodDescriptionfindCMAttribute(String attributeName, String namespace) Returns the declared attribute which match the given name and null otherwise.default CMAttributeDeclarationfindCMAttribute(DOMAttr attr) Returns the declared attribute which match the given name and null otherwise.findCMElement(String tag, String namespace) Returns the declared element which matches the given XML tag name / namespace and null otherwise.Returns the attributes of this declared element.default Collection<CMElementDeclaration> Returns the children elements that form valid content for this element.default StringReturns the explicit default value from the schema declaration, or null if none is declared.default Collection<String> Returns the local names of types derived from this element's declared type.getDocumentation(ISharedSettingsRequest request) Returns formatted documentation of the declared element, according to settings defined inrequest.Returns the owner document URI where the element is declared.Returns the children declared element of this declared element.Return the enumeration values.Returns the declared element local name.default StringReturns the declared element name with the given prefix.Returns the target namespace and null otherwise.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).getPossibleElements(DOMElement parentElement, int offset) Returns the possible declared elements at the given offset of the given parent element.Returns the xmlns prefix from the given namespace URI and null otherwise.Returns a list of required/non-optional child elements of the current element.getTextDocumentation(String value, ISharedSettingsRequest request) Returns the documentation for the given enumeration value and null otherwise.default StringReturns a type-aware default value suitable for document generation.default StringReturns the type name of the declared element (e.g., "xs:integer", "itemType") and null if not available.booleanisEmpty()Returns true if the element cannot contains element children or text content and false otherwise.booleanReturns true if the element can contains text and element both and false otherwise.booleanReturns true if the element can have an explicit null value assigned to it.booleanisOptional(String childElementName) Returns true if the child element name is optional and false otherwise.booleanReturns true if the element is a string type (ex : xs:string) and false otherwise.
-
Field Details
-
ANY_ELEMENT_DECLARATIONS
-
-
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
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
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.
-
getPossibleAttributes
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
Collection<CMElementDeclaration> getElements()Returns the children declared element of this declared element.- Returns:
- the children declared element of this declared element.
-
getContentElements
Returns the children elements that form valid content for this element. UnlikegetElements()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
Returns the possible declared elements at the given offset of the given parent element.- Parameters:
parentElement- the parent elementoffset- the offset- Returns:
- the possible declared elements at the given offset of the given parent element.
-
findCMElement
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
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
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.
-
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
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
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 togetDefaultValue().- Returns:
- the type-aware default value, or null.
-
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.
-
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
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
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.
-