org.haphazard.XML
Class XML

java.lang.Object
  extended byorg.haphazard.XML.XML

public class XML
extends java.lang.Object

Static class for common XMLoperations


Field Summary
static java.lang.String INDENT
          A String with empty spaces to facilitate the indentation of a generated file
 
Constructor Summary
XML()
           
 
Method Summary
static java.lang.String getHeader(java.lang.String rootElement, java.lang.String publicID)
          Gets the header for the xml-file
static java.lang.String indent(int indentLevel)
          Fixes indentation in the string
static java.lang.String nl()
          Gets the systems newline character
static java.lang.String toXML(java.lang.String str)
          Replaces characters that interferes with XML parsing to their ISO equivalents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDENT

public static java.lang.String INDENT
A String with empty spaces to facilitate the indentation of a generated file

Constructor Detail

XML

public XML()
Method Detail

getHeader

public static java.lang.String getHeader(java.lang.String rootElement,
                                         java.lang.String publicID)
Gets the header for the xml-file

Parameters:
rootElement - The root XML element of the file.
publicID - The name of the dtd.
Returns:
A header in xml explaining XML-version and dtd

indent

public static java.lang.String indent(int indentLevel)
Fixes indentation in the string

Parameters:
indentLevel - Which level the string should be indented as. Each level is represented by 2 spaces.
Returns:
A series of spaces representing the indentation.

nl

public static java.lang.String nl()
Gets the systems newline character

Returns:
The systems newline character

toXML

public static java.lang.String toXML(java.lang.String str)
Replaces characters that interferes with XML parsing to their ISO equivalents. Replaces all &,>,< with &, >, <.

Parameters:
str - The string to check and replace
Returns:
The string with &,<,> replaced.