Class Attribute

java.lang.Object
de.pdark.decentxml.BasicNode
de.pdark.decentxml.Attribute
All Implemented Interfaces:
Node

public class Attribute extends BasicNode
This class represents an attribute of an Element
See Also:
  • Field Details

    • namespace

      private Namespace namespace
    • preSpace

      private String preSpace
      Space before the name
    • name

      private String name
    • equalsSpace

      private String equalsSpace
      Space around the equals sign (incl. the sign)
    • rawValue

      private String rawValue
    • value

      private String value
    • quoteChar

      private char quoteChar
  • Constructor Details

    • 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(String name, 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(String name, 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(String name, 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(String name, 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 Details

    • getName

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

      public void setName(String name)
    • getValue

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

      public void setValue(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 String getPreSpace()
    • setPreSpace

      public Attribute setPreSpace(String preSpace)
    • getEqualsSpace

      public String getEqualsSpace()
    • setEqualsSpace

      public Attribute setEqualsSpace(String equalsSpace)
    • checkQuoteChar

      public static char checkQuoteChar(String value, char quoteChar)
    • toXML

      public BasicNode toXML(XMLWriter writer) throws 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:
      IOException
    • createClone

      public Attribute createClone()
      Description copied from interface: Node
      Simulate clone()
      Specified by:
      createClone in interface Node
      Overrides:
      createClone in class BasicNode
    • 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
    • copy

      public Attribute copy()
      Description copied from interface: Node
      Simulate clone()
      Specified by:
      copy in interface Node
      Overrides:
      copy in class BasicNode