dfki.util.xml
Class XML.DOM

java.lang.Object
  |
  +--dfki.util.xml.XML.DOM
Direct Known Subclasses:
XercesDOMImpl, XML.PDOM
Enclosing class:
XML

public abstract static class XML.DOM
extends java.lang.Object

Defines a programming interface for accessing XML structures represented in the document object model (DOM). The interface hides implementation specific details and allows for dynamic DOM implementation selection. Methods not depending on a particular DOM implementation are made static.


Inner Class Summary
static class XML.DOM.Exception
           
 
Constructor Summary
XML.DOM()
           
 
Method Summary
static org.w3c.dom.Element createCDATAElement(org.w3c.dom.Document ownerDocument, java.lang.String elementName, java.lang.String text)
          Creates an element and a subsequent CDataSection.
static org.w3c.dom.Element createTextElement(org.w3c.dom.Document ownerDocument, java.lang.String elementName, java.lang.String text)
          Creates an element and a subsequent text node.
static java.lang.String getText(org.w3c.dom.Node node)
          Returns all text nodes concatenated.
static void getText(org.w3c.dom.Node node, java.lang.StringBuffer buffer)
          Returns all text nodes concatenated.
abstract  org.w3c.dom.Document newDocument()
          Creates a new document instance.
static void print(org.w3c.dom.Document doc)
          Prints the XML document to System.out.
static void print(org.w3c.dom.Document doc, java.io.OutputStream os)
          Prints the XML document to the given output stream.
static void print(org.w3c.dom.Document doc, java.io.Writer writer)
          Prints the XML document to the given writer.
static void print(org.w3c.dom.Element elt)
          Prints the XML element to System.out.
static void print(org.w3c.dom.Element elt, java.io.OutputStream os)
          Prints the XML element to the given output stream.
static void print(org.w3c.dom.Element elt, java.io.Writer writer)
          Prints the XML element to the given writer.
abstract  org.w3c.dom.Document readFromString(java.lang.String source)
           
abstract  org.w3c.dom.Document readFromURI(java.lang.String fileName)
           
static java.lang.String toString(org.w3c.dom.Document doc)
          Converts the given DOM structure into a string representation.
static java.lang.String toString(org.w3c.dom.Element elt)
          Converts the given element into a string representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XML.DOM

public XML.DOM()
Method Detail

readFromURI

public abstract org.w3c.dom.Document readFromURI(java.lang.String fileName)
                                          throws org.xml.sax.SAXException,
                                                 java.io.IOException

readFromString

public abstract org.w3c.dom.Document readFromString(java.lang.String source)
                                             throws org.xml.sax.SAXException,
                                                    java.io.IOException

newDocument

public abstract org.w3c.dom.Document newDocument()
Creates a new document instance.

createTextElement

public static org.w3c.dom.Element createTextElement(org.w3c.dom.Document ownerDocument,
                                                    java.lang.String elementName,
                                                    java.lang.String text)
Creates an element and a subsequent text node.

createCDATAElement

public static org.w3c.dom.Element createCDATAElement(org.w3c.dom.Document ownerDocument,
                                                     java.lang.String elementName,
                                                     java.lang.String text)
Creates an element and a subsequent CDataSection.

print

public static void print(org.w3c.dom.Document doc,
                         java.io.OutputStream os)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML document to the given output stream.

print

public static void print(org.w3c.dom.Document doc,
                         java.io.Writer writer)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML document to the given writer.

print

public static void print(org.w3c.dom.Document doc)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML document to System.out.

toString

public static java.lang.String toString(org.w3c.dom.Document doc)
Converts the given DOM structure into a string representation.
Returns:
The string representation; null in the case of a failure.

print

public static void print(org.w3c.dom.Element elt,
                         java.io.OutputStream os)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML element to the given output stream.

print

public static void print(org.w3c.dom.Element elt,
                         java.io.Writer writer)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML element to the given writer.

print

public static void print(org.w3c.dom.Element elt)
                  throws org.xml.sax.SAXException,
                         java.io.IOException
Prints the XML element to System.out.

toString

public static java.lang.String toString(org.w3c.dom.Element elt)
Converts the given element into a string representation.
Returns:
The string representation; null in the case of a failure.

getText

public static java.lang.String getText(org.w3c.dom.Node node)
Returns all text nodes concatenated.

getText

public static void getText(org.w3c.dom.Node node,
                           java.lang.StringBuffer buffer)
Returns all text nodes concatenated.