Class Attribute

  • All Implemented Interfaces:
    Node

    public class Attribute
    extends BasicNode
    This class represents an attribute of an Element
    Author:
    digulla
    See Also:
    Element
    • Constructor Detail

      • Attribute

        public Attribute​(Token token)
        Create an attribute from a Token.

        The token must include the space before the name and end with the closing quote.

        Parameters:
        token -
      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String value)
        Create an attribute with a certain name and value.

        The quote to use is determined automatically depending on the content of the value

      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String value,
                         Namespace namespace)
        Create an attribute with a certain name and value.

        The quote to use is determined automatically depending on the content of the value

      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String value,
                         char quoteChar)
        Create an attribute with a certain name and value plus a preference for the quote character that should be used.

        If the quote character exists in the value, it is ignored.

      • Attribute

        public Attribute​(java.lang.String name,
                         java.lang.String value,
                         Namespace namespace,
                         char quoteChar)
        Create an attribute with a certain name and value plus a preference for the quote character that should be used.

        If the quote character exists in the value, it is ignored.

    • Method Detail

      • getName

        public java.lang.String getName()
        Return the name of the attribute
      • setName

        public void setName​(java.lang.String name)
      • getValue

        public java.lang.String getValue()
        Return the value of the attribute
        Overrides:
        getValue in class BasicNode
      • setValue

        public void setValue​(java.lang.String value)
        Overrides:
        setValue in class BasicNode
      • getNamespace

        public Namespace getNamespace()
      • setNamespace

        public void setNamespace​(Namespace namespace)
      • getQuoteChar

        public int getQuoteChar()
      • setQuoteChar

        public Attribute setQuoteChar​(char quoteChar)
      • getPreSpace

        public java.lang.String getPreSpace()
      • setPreSpace

        public Attribute setPreSpace​(java.lang.String preSpace)
      • getEqualsSpace

        public java.lang.String getEqualsSpace()
      • setEqualsSpace

        public Attribute setEqualsSpace​(java.lang.String equalsSpace)
      • checkQuoteChar

        public static char checkQuoteChar​(java.lang.String value,
                                          char quoteChar)
      • toXML

        public BasicNode toXML​(XMLWriter writer)
                        throws java.io.IOException
        Description copied from class: BasicNode
        Append the content of this node to writer
        Specified by:
        toXML in interface Node
        Overrides:
        toXML in class BasicNode
        Throws:
        java.io.IOException
      • copy

        public Attribute copy​(Node orig)
        Description copied from interface: Node
        Copy all data from orig into this
        Specified by:
        copy in interface Node
        Overrides:
        copy in class BasicNode