Modifier | Constructor and Description |
---|---|
protected |
XmlNode(Element target)
Creates a new
XmlNode . |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(XmlAttribute a)
Adds an attribute to this node.
|
void |
addAttributes(XmlAttribute... attributes)
Adds one or more attributes to this node.
|
void |
addCdata(String data)
Adds a CDATA section to this node.
|
XmlNode |
addNewNode(String name)
Creates and adds a new XML node to this node.
|
XmlNode |
addNewNode(String name,
XmlAttributes attributes)
Creates and adds a new XML node to this node.
|
void |
addText(String text)
Adds a text node to this node.
|
int |
attributeCount()
Returns the number of attributes in this node.
|
XmlNode |
child(int index)
Returns the child at the given index.
|
boolean |
equals(Object obj) |
int |
hashCode() |
String |
name()
Returns the name of this node.
|
XmlNode |
parentNode()
Returns the parent node of this node.
|
int |
size()
Returns the number of children in this node.
|
Element |
target()
Returns the underlying DOM
. |
String |
text()
Returns the text content of this node.
|
String |
toString() |
String |
valueOfAttribute(String name)
Returns the value of the given attribute, or an empty
String if this node does not contain an
attribute with the given name. |
public XmlNode addNewNode(String name)
name
- the name of the node to add.public XmlNode addNewNode(String name, XmlAttributes attributes)
name
- the name of the node to add.attributes
- the attributes of the node to add.public void addCdata(String data)
data
- the data for the CDATA section to create.public void addText(String text)
text
- the text of the new text node.public void addAttribute(XmlAttribute a)
a
- the attribute to add.public void addAttributes(XmlAttribute... attributes)
attributes
- the attribute(s) to add to this node.public Element target()
Element
.public XmlNode parentNode()
public int size()
public XmlNode child(int index)
index
- the given index.public String valueOfAttribute(String name)
String
if this node does not contain an
attribute with the given name.name
- the name of the attribute we are looking for.String
if this node does not
contain a matching attribute.public String name()
public String text()
public int attributeCount()
Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.