Package uk.ac.starlink.ttools.cea
Class ElementDeclaration
java.lang.Object
uk.ac.starlink.ttools.cea.ElementDeclaration
Encapsulates the declaration of an XML element.
- Since:
- 1 Nov 2007
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionElementDeclaration
(String elName) Constructs a declaration with a name but no attributes.ElementDeclaration
(String elName, String attList) Constructs a declaration with a name and attributes. -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementDeclaration
createNamespaceElement
(String elName, String ns) Convenience method to create an element with an attribute list defining a default namespace for this element and its descendents.Returns the element attribute list.Returns the element name.boolean
hasAttribute
(String attName) Queries whether a given attribute is known to be permitted on this element.void
setAttributeNames
(String[] attNames) Sets a list of permitted attribute names associated with this declaration.
-
Constructor Details
-
ElementDeclaration
Constructs a declaration with a name but no attributes.- Parameters:
elName
- element name (possibly prefixed)
-
ElementDeclaration
Constructs a declaration with a name and attributes. The supplied attribute list is exactly as it will be inserted into the output, so it must start with a space (if it's not empty) and any relevant escaping must have been done.- Parameters:
elName
- element name (possibly prefixed)attList
- attribute list string
-
-
Method Details
-
setAttributeNames
Sets a list of permitted attribute names associated with this declaration. This does not necessarily give all the permitted attributes, but it can be used to designate a list of attributes which may be in doubt.- Parameters:
attNames
- list of attribute names which are permitted on this element
-
hasAttribute
Queries whether a given attribute is known to be permitted on this element.- Parameters:
attName
- attribute name- Returns:
- true iff attName is permitted
-
getElementName
Returns the element name.- Returns:
- element name, possibly prefixed
-
getElementAttributes
Returns the element attribute list. It appears exactly as it should be inserted into the output, so it should start with a space (if it's not empty) and any relevant escaping should have been done.- Returns:
- element attribute list
-
createNamespaceElement
Convenience method to create an element with an attribute list defining a default namespace for this element and its descendents.- Parameters:
elName
- element name, possibly prefixedns
- default namespace URI- Returns:
- new element declaration
-