public class Xml
extends java.lang.Object
| Constructor and Description |
|---|
Xml() |
| Modifier and Type | Method and Description |
|---|---|
static Element |
addChildTo(Element parent,
java.lang.String name,
java.lang.String text)
Creates a child element and adds it to parent.
|
static Document |
buildDocument(java.lang.String fileName)
Returns a JDOM document built from a file, or from scratch, if the file does not exist.
|
static Element |
getChildOf(Element element,
java.lang.String name)
Returns the child of an element and creates the child, if it does not exist.
|
static java.lang.String |
getNodeContent(Element node,
java.lang.String property)
Returns the content of either a child or a attribute of node parent
|
static boolean |
getProperty(Element properties,
java.lang.String propertyName,
boolean defaultValue)
Returns the content of either a child node or an attribute of the XML element.
|
static double |
getProperty(Element properties,
java.lang.String propertyName,
double defaultValue)
Returns the content of either a child node or an attribute of the XML
element.
|
static int |
getProperty(Element properties,
java.lang.String propertyName,
int defaultValue)
Returns the content of either a child node or an attribute of the XML element.
|
static java.lang.String |
getProperty(Element properties,
java.lang.String propertyName,
java.lang.String defaultValue)
Returns the content of either a child node or an attribute of the XML
element.
|
static void |
saveDocument(Document document,
java.lang.String fileName)
Writes a JDOM document to a file of given name.
|
public static Document buildDocument(java.lang.String fileName)
fileName - the name of the filepublic static Element addChildTo(Element parent,
java.lang.String name,
java.lang.String text)
parent - the parent elementname - the child's nametext - the child's textpublic static Element getChildOf(Element element,
java.lang.String name)
element - a JDOM elementname - the child's namepublic static java.lang.String getNodeContent(Element node,
java.lang.String property)
node - The nodeproperty - specifies the name of the desired propertypublic static void saveDocument(Document document,
java.lang.String fileName)
document - a JDOM documentfileName - the name of the filepublic static java.lang.String getProperty(Element properties,
java.lang.String propertyName,
java.lang.String defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static int getProperty(Element properties,
java.lang.String propertyName,
int defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static double getProperty(Element properties,
java.lang.String propertyName,
double defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static boolean getProperty(Element properties,
java.lang.String propertyName,
boolean defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - default