Interface CMAttributeDeclaration
- All Known Implementing Classes:
CMDTDAttributeDeclaration,CMXSDAttributeDeclaration
public interface CMAttributeDeclaration
Content model element which abstracts attribute declaration from a given
grammar (XML Schema, DTD, RelaxNG).
-
Method Summary
Modifier and TypeMethodDescriptionReturns formatted documentation of the declared attribute according to settings defined inrequestgetAttributeValueDocumentation(String value, ISharedSettingsRequest request) Returns formatted documentation aboutvalue, according to settings defined inrequestReturns the explicit default value of the declared attribute (from schemadefaultorfixedconstraints) and null otherwise.Returns enumeration values of the declared attribute and empty collection otherwise.default Collection<String> getEnumerationValues(DOMElement element) Returns enumeration values of the declared attribute filtered by the context of the given DOM element.Returns the declared attribute local name.default StringReturns the declared attribute name with the given prefix.default StringReturns the declared attribute name with the proper prefix mapped with the attribute namespace and the local name otherwise.Returns the target namespace and null otherwise.Returns the owner element declaration.default StringReturns a type-aware default value suitable for document generation.default StringReturns the type name of the declared attribute (e.g., "xs:integer", "xs:boolean") and null if not available.booleanReturns true if the attribute is required and false otherwise.
-
Method Details
-
getPrefix
String getPrefix() -
getLocalName
String getLocalName()Returns the declared attribute local name.- Returns:
- the declared attribute local name.
-
getNamespace
String getNamespace()Returns the target namespace and null otherwise.- Returns:
- the target namespace and null otherwise.
-
getOwnerElementDeclaration
CMElementDeclaration getOwnerElementDeclaration()Returns the owner element declaration.- Returns:
- the owner element declaration.
-
getName
Returns the declared attribute name with the given prefix.- Returns:
- the declared attribute name with the given prefix.
-
getName
Returns the declared attribute name with the proper prefix mapped with the attribute namespace and the local name otherwise.- Parameters:
prefixes- map which contains namespace as key and prefix as value.- Returns:
- the declared attribute name with the proper prefix mapped with the attribute namespace and the local name otherwise.
-
getDefaultValue
String getDefaultValue()Returns the explicit default value of the declared attribute (from schemadefaultorfixedconstraints) and null otherwise. Does NOT include type-inferred defaults.- Returns:
- the explicit default value of the declared attribute and null otherwise.
-
getTypeAwareDefaultValue
Returns a type-aware default value suitable for document generation. For XSD attributes, this returns type-inferred defaults (e.g., "0" for xs:decimal) when no explicit default exists. For other grammars, defaults togetDefaultValue().- Returns:
- the type-aware default value, or null.
-
getTypeName
Returns the type name of the declared attribute (e.g., "xs:integer", "xs:boolean") and null if not available.- Returns:
- the type name and null otherwise.
-
getEnumerationValues
Collection<String> getEnumerationValues()Returns enumeration values of the declared attribute and empty collection otherwise.- Returns:
- enumeration values of the declared attribute and empty collection otherwise.
-
getEnumerationValues
Returns enumeration values of the declared attribute filtered by the context of the given DOM element. Grammars that need context-dependent filtering (e.g. RelaxNGdatatypeLibrary) override this method.- Parameters:
element- the DOM element providing context for filtering.- Returns:
- the filtered enumeration values.
-
isRequired
boolean isRequired()Returns true if the attribute is required and false otherwise.- Returns:
- true if the attribute is required and false otherwise.
-