Xml (JEvolution)
Date: 2013-03-21

evSOLve.JEvolution.misc

## Class Xml

- java.lang.Object
- - evSOLve.JEvolution.misc.Xml

-     public class Xml
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Xml()`

  - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Xml

          public Xml()

  - ### Method Detail

    - #### buildDocument

          public static Document buildDocument(java.lang.String fileName)

      Returns a JDOM document built from a file, or from scratch, if the file does not exist.
      Parameters:
        `fileName` - the name of the file
      Returns:
        a JDOM document (may be empty)

    - #### addChildTo

          public static Element addChildTo(Element parent,
                           java.lang.String name,
                           java.lang.String text)

      Creates a child element and adds it to parent.
      Parameters:
        `parent` - the parent element
        `name` - the child's name
        `text` - the child's text
      Returns:
        the child

    - #### getChildOf

          public static Element getChildOf(Element element,
                           java.lang.String name)

      Returns the child of an element and creates the child, if it does not exist.
      Parameters:
        `element` - a JDOM element
        `name` - the child's name
      Returns:
        the child

    - #### getNodeContent

          public static java.lang.String getNodeContent(Element node,
                                        java.lang.String property)

      Returns the content of either a child or a attribute of node parent
      Parameters:
        `node` - The node
        `property` - specifies the name of the desired property
      Returns:
        the content of the child or attribute of the node

    - #### saveDocument

          public static void saveDocument(Document document,
                          java.lang.String fileName)

      Writes a JDOM document to a file of given name.
      Parameters:
        `document` - a JDOM document
        `fileName` - the name of the file

    - #### getProperty

          public 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.
      If the xml element or the child or the attribute is null the specified default value is returned.
      Parameters:
        `properties` - XML element
        `propertyName` - the name of the property
        `defaultValue` - default
      Returns:
        property or default, if undefined

    - #### getProperty

          public 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. If the xml element or the child or the attribute is null or a parse error occurs the specified default value is returned.
      Parameters:
        `properties` - XML element
        `propertyName` - the name of the property
        `defaultValue` - default
      Returns:
        property or default, if undefined

    - #### getProperty

          public 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. If the xml element or the child or the attribute is null or a parse error occurs the specified default value is returned.
      Parameters:
        `properties` - XML element
        `propertyName` - the name of the property
        `defaultValue` - default
      Returns:
        property or default, if undefined

    - #### getProperty

          public 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. If the xml element or the child or the attribute is null the specified default value is returned.
      Parameters:
        `properties` - XML element
        `propertyName` - the name of the property
        `defaultValue` - default
      Returns:
        property or default, if undefined