de.pdark.decentxml
Class Attribute

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

public class Attribute
extends BasicNode

This class represents an attribute of an Element

Author:
digulla
See Also:
Element

Constructor Summary
Attribute(java.lang.String name, java.lang.String value)
          Create an attribute with a certain name and value.
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.
Attribute(java.lang.String name, java.lang.String value, Namespace namespace)
          Create an attribute with a certain name and value.
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.
Attribute(Token token)
          Create an attribute from a Token.
 
Method Summary
static char checkQuoteChar(java.lang.String value, char quoteChar)
           
 Attribute copy()
          Simulate clone()
 Attribute copy(Node orig)
          Copy all data from orig into this
 Attribute createClone()
          Simulate clone()
 java.lang.String getEqualsSpace()
           
 java.lang.String getName()
          Return the name of the attribute
 Namespace getNamespace()
           
 java.lang.String getPreSpace()
           
 int getQuoteChar()
           
 java.lang.String getValue()
          Return the value of the attribute
 Attribute setEqualsSpace(java.lang.String equalsSpace)
           
 void setName(java.lang.String name)
           
 void setNamespace(Namespace namespace)
           
 Attribute setPreSpace(java.lang.String preSpace)
           
 Attribute setQuoteChar(char quoteChar)
           
 void setValue(java.lang.String value)
           
 BasicNode toXML(XMLWriter writer)
          Append the content of this node to writer
 
Methods inherited from class de.pdark.decentxml.BasicNode
getEndOffset, getStartOffset, getToken, getType, setType, toString, toXML, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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


Copyright © 2008-2011. All Rights Reserved.