public class SimpleXmlNode extends Object
| Constructor and Description |
|---|
SimpleXmlNode(String name)
Construct a new SimpleXmlNode with the given element name.
|
| Modifier and Type | Method and Description |
|---|---|
SimpleXmlNode |
deepCopy()
Makes a deep copy of this node, including copies of all contained children.
|
Map<String,String> |
getAttributes()
Returns the attributes associated with this node.
|
List<SimpleXmlNode> |
getChildren()
Returns the immediate children of this node.
|
Iterable<SimpleXmlNode> |
getDescendents()
Returns an Iterable over the descendents of this node (not including this node).
|
String |
getName()
Returns the name of this node.
|
SimpleXmlNode |
getParent()
Returns the parent of this node, or null if this node is a root node.
|
String |
getText()
Returns the textual content of this node, if any.
|
static SimpleXmlNode |
parse(File f)
Parse the given File to create a SimpleXmlNode.
|
static SimpleXmlNode |
parse(InputStream is)
Parse the given InputStream to create a SimpleXmlNode.
|
static SimpleXmlNode |
parse(String s)
Parse the given String to create a SimpleXmlNode.
|
void |
setName(String name)
Sets the name of this node.
|
void |
setText(String text)
Sets the text content of this node.
|
SimpleXmlNode |
shallowCopy()
Makes a shallow copy of this node, including its name, text, and attributes.
|
String |
toXmlString()
Returns a version of this node, including all its children, as a valid XML String.
|
public SimpleXmlNode(String name)
name - the name of the nodepublic static SimpleXmlNode parse(String s)
s - the XML content to be parsedpublic static SimpleXmlNode parse(File f)
f - the File containing XML content to be parsedpublic static SimpleXmlNode parse(InputStream is)
is - the InputStream containing XML content to be parsedpublic List<SimpleXmlNode> getChildren()
public Iterable<SimpleXmlNode> getDescendents()
public Map<String,String> getAttributes()
public String getName()
public void setName(String name)
name - the new namepublic String getText()
public void setText(String text)
text - the text content for the nodepublic SimpleXmlNode getParent()
public SimpleXmlNode shallowCopy()
public SimpleXmlNode deepCopy()
public String toXmlString()
Copyright © 2018. All rights reserved.