Package de.pdark.decentxml
Class Attribute
- java.lang.Object
-
- de.pdark.decentxml.BasicNode
-
- de.pdark.decentxml.Attribute
-
-
Constructor Summary
Constructors Constructor Description Attribute(Token token)
Create an attribute from a Token.Attribute(String name, String value)
Create an attribute with a certain name and value.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.Attribute(String name, String value, Namespace namespace)
Create an attribute with a certain name and value.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static char
checkQuoteChar(String value, char quoteChar)
Attribute
copy()
Simulate clone()Attribute
copy(Node orig)
Copy all data fromorig
intothis
Attribute
createClone()
Simulate clone()String
getEqualsSpace()
String
getName()
Return the name of the attributeNamespace
getNamespace()
String
getPreSpace()
int
getQuoteChar()
String
getValue()
Return the value of the attributeAttribute
setEqualsSpace(String equalsSpace)
void
setName(String name)
void
setNamespace(Namespace namespace)
Attribute
setPreSpace(String preSpace)
Attribute
setQuoteChar(char quoteChar)
void
setValue(String value)
BasicNode
toXML(XMLWriter writer)
Append the content of this node towriter
-
Methods inherited from class de.pdark.decentxml.BasicNode
getEndOffset, getStartOffset, getToken, getType, setType, toString, toXML, toXML
-
-
-
-
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(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.
-
-
Method Detail
-
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
-
getNamespace
public Namespace getNamespace()
-
setNamespace
public void setNamespace(Namespace namespace)
-
getQuoteChar
public int getQuoteChar()
-
setQuoteChar
public Attribute setQuoteChar(char quoteChar)
-
getPreSpace
public String getPreSpace()
-
getEqualsSpace
public String getEqualsSpace()
-
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 towriter
- Specified by:
toXML
in interfaceNode
- Overrides:
toXML
in classBasicNode
- Throws:
IOException
-
createClone
public Attribute createClone()
Description copied from interface:Node
Simulate clone()- Specified by:
createClone
in interfaceNode
- Overrides:
createClone
in classBasicNode
-
copy
public Attribute copy(Node orig)
Description copied from interface:Node
Copy all data fromorig
intothis
-
-