Class ElementDeclaration


  • public class ElementDeclaration
    extends java.lang.Object
    Encapsulates the declaration of an XML element.
    Since:
    1 Nov 2007
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      ElementDeclaration​(java.lang.String elName)
      Constructs a declaration with a name but no attributes.
      ElementDeclaration​(java.lang.String elName, java.lang.String attList)
      Constructs a declaration with a name and attributes.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ElementDeclaration createNamespaceElement​(java.lang.String elName, java.lang.String ns)
      Convenience method to create an element with an attribute list defining a default namespace for this element and its descendents.
      java.lang.String getElementAttributes()
      Returns the element attribute list.
      java.lang.String getElementName()
      Returns the element name.
      boolean hasAttribute​(java.lang.String attName)
      Queries whether a given attribute is known to be permitted on this element.
      void setAttributeNames​(java.lang.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​(java.lang.String elName)
        Constructs a declaration with a name but no attributes.
        Parameters:
        elName - element name (possibly prefixed)
      • ElementDeclaration

        public ElementDeclaration​(java.lang.String elName,
                                  java.lang.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​(java.lang.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​(java.lang.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 java.lang.String getElementName()
        Returns the element name.
        Returns:
        element name, possibly prefixed
      • getElementAttributes

        public java.lang.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​(java.lang.String elName,
                                                                java.lang.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