uk.ac.starlink.ttools.cea
Class ElementDeclaration

java.lang.Object
  extended by uk.ac.starlink.ttools.cea.ElementDeclaration

public class ElementDeclaration
extends Object

Encapsulates the declaration of an XML element.

Since:
1 Nov 2007
Author:
Mark Taylor

Constructor Summary
ElementDeclaration(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
static 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.
 String getElementAttributes()
          Returns the element attribute list.
 String getElementName()
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementDeclaration

public ElementDeclaration(String elName)
Constructs a declaration with a name but no attributes.

Parameters:
elName - element name (possibly prefixed)

ElementDeclaration

public ElementDeclaration(String elName,
                          String attList)
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 Detail

setAttributeNames

public void setAttributeNames(String[] attNames)
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

public boolean hasAttribute(String attName)
Queries whether a given attribute is known to be permitted on this element.

Parameters:
attName - attribute name
Returns:
true iff attName is permitted

getElementName

public String getElementName()
Returns the element name.

Returns:
element name, possibly prefixed

getElementAttributes

public String 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

public static 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.

Parameters:
elName - element name, possibly prefixed
ns - default namespace URI
Returns:
new element declaration


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.