net.sf.freecol.common.util
Class Xml

java.lang.Object
  extended by net.sf.freecol.common.util.Xml

public final class Xml
extends java.lang.Object

A class that makes it slightly tidier to create, parse and format XML documents.


Nested Class Summary
static class Xml.Exception
          This class is defined so that exceptions thrown by methods on Xml may be filtered from other runtime exceptions such as NullPointerException if desired.
static interface Xml.Method
           
 
Method Summary
static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, java.lang.String separator)
           
static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, java.lang.String[] otherwise)
           
static java.lang.String attribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static java.lang.String attribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, java.lang.String otherwise)
           
static boolean booleanAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static boolean booleanAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, boolean otherwise)
           
static char charAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static char charAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, char otherwise)
           
static org.w3c.dom.Document documentFrom(java.io.InputStream stream)
           
static org.w3c.dom.Document documentFrom(java.lang.String string)
           
static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, float[] otherwise)
           
static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, java.lang.String separator)
           
static float floatAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static float floatAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, float otherwise)
           
static void forEachChild(org.w3c.dom.Node xml, Xml.Method method)
           
static boolean hasAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static int[] intArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static int[] intArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, int[] otherwise)
           
static int[] intArrayAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, java.lang.String separator)
           
static int intAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName)
           
static int intAttribute(org.w3c.dom.Node xmlElement, java.lang.String attributeName, int otherwise)
           
static org.w3c.dom.Document newDocument()
           
static java.lang.String toString(org.w3c.dom.Document document)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newDocument

public static org.w3c.dom.Document newDocument()

documentFrom

public static org.w3c.dom.Document documentFrom(java.lang.String string)

documentFrom

public static org.w3c.dom.Document documentFrom(java.io.InputStream stream)

toString

public static java.lang.String toString(org.w3c.dom.Document document)

hasAttribute

public static boolean hasAttribute(org.w3c.dom.Node xmlElement,
                                   java.lang.String attributeName)

attribute

public static java.lang.String attribute(org.w3c.dom.Node xmlElement,
                                         java.lang.String attributeName)

attribute

public static java.lang.String attribute(org.w3c.dom.Node xmlElement,
                                         java.lang.String attributeName,
                                         java.lang.String otherwise)

arrayAttribute

public static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement,
                                                java.lang.String attributeName,
                                                java.lang.String separator)

arrayAttribute

public static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement,
                                                java.lang.String attributeName)

arrayAttribute

public static java.lang.String[] arrayAttribute(org.w3c.dom.Node xmlElement,
                                                java.lang.String attributeName,
                                                java.lang.String[] otherwise)

charAttribute

public static char charAttribute(org.w3c.dom.Node xmlElement,
                                 java.lang.String attributeName)

charAttribute

public static char charAttribute(org.w3c.dom.Node xmlElement,
                                 java.lang.String attributeName,
                                 char otherwise)

floatAttribute

public static float floatAttribute(org.w3c.dom.Node xmlElement,
                                   java.lang.String attributeName)

floatAttribute

public static float floatAttribute(org.w3c.dom.Node xmlElement,
                                   java.lang.String attributeName,
                                   float otherwise)

floatArrayAttribute

public static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement,
                                          java.lang.String attributeName,
                                          java.lang.String separator)

floatArrayAttribute

public static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement,
                                          java.lang.String attributeName)

floatArrayAttribute

public static float[] floatArrayAttribute(org.w3c.dom.Node xmlElement,
                                          java.lang.String attributeName,
                                          float[] otherwise)

intAttribute

public static int intAttribute(org.w3c.dom.Node xmlElement,
                               java.lang.String attributeName)

intAttribute

public static int intAttribute(org.w3c.dom.Node xmlElement,
                               java.lang.String attributeName,
                               int otherwise)

intArrayAttribute

public static int[] intArrayAttribute(org.w3c.dom.Node xmlElement,
                                      java.lang.String attributeName,
                                      java.lang.String separator)

intArrayAttribute

public static int[] intArrayAttribute(org.w3c.dom.Node xmlElement,
                                      java.lang.String attributeName)

intArrayAttribute

public static int[] intArrayAttribute(org.w3c.dom.Node xmlElement,
                                      java.lang.String attributeName,
                                      int[] otherwise)

booleanAttribute

public static boolean booleanAttribute(org.w3c.dom.Node xmlElement,
                                       java.lang.String attributeName)

booleanAttribute

public static boolean booleanAttribute(org.w3c.dom.Node xmlElement,
                                       java.lang.String attributeName,
                                       boolean otherwise)

forEachChild

public static void forEachChild(org.w3c.dom.Node xml,
                                Xml.Method method)