ix.iface.util
Class XML

java.lang.Object
  |
  +--ix.iface.util.XML

public class XML
extends java.lang.Object

A class that encapsulates the XML knowledge needed for sending and receiving Issues and Reports and that contains other useful static XML utilities.

Example issue:

    <issue sender-id="ILEED" ref="ILEED-IDEEL-1" report-back="no">
       <priority>high</priority>
       <statement>avoid elephants laki_safari_park</statement>
    </issue>
 
Example report:
    <report sender-id="MCA" ref="MCA-IDEEL-1">
       done - no conflicts
    </report>
 


Inner Class Summary
static class XML.XMLException
          Thrown to indicate a problem converting to or from XML.
 
Field Summary
static java.util.Set issueAttributes
          A Set containing the attribute names that are valid in "issue" elements.
static org.jdom.output.XMLOutputter prettyXMLOutputter
          An XML outputter created by makePrettyXMLOutputter().
static java.util.Set reportAttributes
          A Set containing the attribute names that are valid in "report" elements.
(package private) static java.lang.String SAXDriverClass
          The class of the SAX parser used by the parseXML method.
 
Method Summary
static java.lang.String issueDescription(Issue i)
           
static Issue issueFromXML(org.jdom.Element issueElt)
          Converts a JDOM Element to an Issue.
static java.lang.String issueToXML(Issue issue)
           
static org.jdom.output.XMLOutputter makePrettyXMLOutputter()
          Constructs a JDOM XMLOutputter that outputs a JDOM Document in a nicely indented fashion.
static java.lang.Object objectFromXML(java.lang.String text)
          Converts a string of XML to an Issue or Report object.
static java.lang.String objectToXML(java.lang.Object contents)
          Converts an Issue or Report Object to a string of XML.
static org.jdom.Document parseXML(java.lang.String text)
          Converts a string of XML to a JDOM Document.
static int priorityFromXML(org.jdom.Element priorityElt)
           
static java.lang.String priorityToXML(int priority)
           
static java.util.Map propertiesFromAttributes(org.jdom.Element elt, java.util.Set validNames)
          Converts XML attributes to a Map.
static java.lang.String propertiesToAttributes(java.util.Map map, java.util.Set validNames)
           
static Report reportFromXML(org.jdom.Element reportElt)
          Converts a JDOM Element to a Report.
static java.lang.String reportToXML(Report report)
           
static java.lang.String statementFromXML(org.jdom.Element statementElt)
           
static java.lang.String statementToXML(java.lang.String statement)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

issueAttributes

public static java.util.Set issueAttributes
A Set containing the attribute names that are valid in "issue" elements.

reportAttributes

public static java.util.Set reportAttributes
A Set containing the attribute names that are valid in "report" elements.

SAXDriverClass

static java.lang.String SAXDriverClass
The class of the SAX parser used by the parseXML method.

prettyXMLOutputter

public static org.jdom.output.XMLOutputter prettyXMLOutputter
An XML outputter created by makePrettyXMLOutputter().
Method Detail

objectFromXML

public static java.lang.Object objectFromXML(java.lang.String text)
Converts a string of XML to an Issue or Report object.

issueFromXML

public static Issue issueFromXML(org.jdom.Element issueElt)
Converts a JDOM Element to an Issue.

priorityFromXML

public static int priorityFromXML(org.jdom.Element priorityElt)

statementFromXML

public static java.lang.String statementFromXML(org.jdom.Element statementElt)

reportFromXML

public static Report reportFromXML(org.jdom.Element reportElt)
Converts a JDOM Element to a Report.

propertiesFromAttributes

public static java.util.Map propertiesFromAttributes(org.jdom.Element elt,
                                                     java.util.Set validNames)
Converts XML attributes to a Map.

parseXML

public static org.jdom.Document parseXML(java.lang.String text)
Converts a string of XML to a JDOM Document.

objectToXML

public static java.lang.String objectToXML(java.lang.Object contents)
Converts an Issue or Report Object to a string of XML.

issueToXML

public static java.lang.String issueToXML(Issue issue)

priorityToXML

public static java.lang.String priorityToXML(int priority)

statementToXML

public static java.lang.String statementToXML(java.lang.String statement)

issueDescription

public static java.lang.String issueDescription(Issue i)

reportToXML

public static java.lang.String reportToXML(Report report)

propertiesToAttributes

public static java.lang.String propertiesToAttributes(java.util.Map map,
                                                      java.util.Set validNames)

makePrettyXMLOutputter

public static org.jdom.output.XMLOutputter makePrettyXMLOutputter()
Constructs a JDOM XMLOutputter that outputs a JDOM Document in a nicely indented fashion. For example:
    XMLOutputter outputter = makePrettyXMLOutputter()
    outputter.output(doc, System.out);
    System.out.flush();