public class Xml
extends java.lang.Object
| Constructor and Description |
|---|
Xml() |
| Modifier and Type | Method and Description |
|---|---|
static org.jdom2.Element |
addChildTo(org.jdom2.Element parent,
java.lang.String name,
java.lang.String text)
Creates a child element and adds it to parent.
|
static void |
addClassName(org.jdom2.Element element,
java.lang.Object o)
Sets the unqualified class name of the given object as an attribute to the given element.
|
static org.jdom2.Element |
addStorable(org.jdom2.Element element,
java.lang.String name,
Storable s)
Adds an XML element representing the Storable.
|
static org.jdom2.Document |
buildDocument()
Returns an empty JDOM document.
|
static org.jdom2.Document |
buildDocument(java.io.File file)
Returns a JDOM document built from a file, or from scratch, if the file does not exist.
|
static org.jdom2.Document |
buildDocument(java.io.InputStream in)
Returns a JDOM document built from a possibly compressed (GZIP) input stream.
|
static org.jdom2.Document |
buildDocument(java.lang.String fileName)
Returns a JDOM document built from a file name, or from scratch, if a file with the given name does not exist.
|
static org.jdom2.Element |
getChildOf(org.jdom2.Element element,
java.lang.String name)
Returns the child of an element and creates the child, if it does not exist.
|
static boolean |
getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
boolean defaultValue)
Returns a property which may have two different names.
|
static double |
getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
double defaultValue)
Returns a property which may have two different names.
|
static int |
getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
int defaultValue)
Returns a property which may have two different names.
|
static long |
getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
long defaultValue)
Returns a property which may have two different names.
|
static java.lang.String |
getNodeContent(org.jdom2.Element node,
java.lang.String property)
Returns the content of either a child or a attribute of node parent
|
static boolean |
getProperty(org.jdom2.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(org.jdom2.Element properties,
java.lang.String propertyName,
double defaultValue)
Returns the content of either a child node or an attribute of the XML
element.
|
static float |
getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
float defaultValue)
Returns the content of either a child node or an attribute of the XML
element.
|
static int |
getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
int defaultValue)
Returns the content of either a child node or an attribute of the XML element.
|
static long |
getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
long defaultValue)
Returns the content of either a child node or an attribute of the XML element.
|
static java.lang.String |
getProperty(org.jdom2.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 Storable |
getStorable(org.jdom2.Element element)
Creates a storable from the given element.
|
static Storable |
getStorable(org.jdom2.Element element,
java.lang.String name)
Creates a storable from the child with given name of the given element.
|
static boolean |
hasAttributeValue(org.jdom2.Element element,
java.lang.String name)
Checks, if an element has a given attribute.
|
static void |
saveDocument(org.jdom2.Document document,
java.io.OutputStream out)
Writes a JDOM document to the given output stream.
|
public static org.jdom2.Document buildDocument()
public static org.jdom2.Document buildDocument(java.lang.String fileName)
fileName - the name of the filepublic static org.jdom2.Document buildDocument(java.io.File file)
file - a filepublic static org.jdom2.Document buildDocument(java.io.InputStream in)
in - an input streampublic static org.jdom2.Element addChildTo(org.jdom2.Element parent,
java.lang.String name,
java.lang.String text)
parent - the parent elementname - the child's nametext - the child's textpublic static org.jdom2.Element getChildOf(org.jdom2.Element element,
java.lang.String name)
element - a JDOM elementname - the child's namepublic static java.lang.String getNodeContent(org.jdom2.Element node,
java.lang.String property)
node - The nodeproperty - specifies the name of the desired propertypublic static void saveDocument(org.jdom2.Document document,
java.io.OutputStream out)
throws java.io.IOException
document - a JDOM documentout - an output streamjava.io.IOExceptionpublic static java.lang.String getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
java.lang.String defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static int getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
int defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static long getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
long defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static int getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
int defaultValue)
properties - XML elementname1 - a name of the propertyname2 - another name of the propertydefaultValue - default valuepublic static long getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
long defaultValue)
properties - XML elementname1 - a name of the propertyname2 - another name of the propertydefaultValue - default valuepublic static double getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
double defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static double getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
double defaultValue)
properties - XML elementname1 - a name of the propertyname2 - another name of the propertydefaultValue - default valuepublic static float getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
float defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static boolean getProperty(org.jdom2.Element properties,
java.lang.String propertyName,
boolean defaultValue)
properties - XML elementpropertyName - the name of the propertydefaultValue - defaultpublic static boolean getDualProperty(org.jdom2.Element properties,
java.lang.String name1,
java.lang.String name2,
boolean defaultValue)
properties - XML elementname1 - a name of the propertyname2 - another name of the propertydefaultValue - default valuepublic static boolean hasAttributeValue(org.jdom2.Element element,
java.lang.String name)
element - an XML elementname - the attribute namepublic static Storable getStorable(org.jdom2.Element element, java.lang.String name)
public static Storable getStorable(org.jdom2.Element element)
public static org.jdom2.Element addStorable(org.jdom2.Element element,
java.lang.String name,
Storable s)
element - the parent elementname - the name of the childs - a Storablepublic static void addClassName(org.jdom2.Element element,
java.lang.Object o)
element - an XML elemento - an object