XDC - v. 0.6.1

net.sf.xdc.util
Class XmlUtils

java.lang.Object
  extended bynet.sf.xdc.util.XmlUtils

public class XmlUtils
extends java.lang.Object

This is a utility class responsible for parsing and printing XML documents.

Since:
0.5
Version:
0.5
Author:
Jens Voß

Method Summary
static org.w3c.dom.Document createDocument()
          This method creates a new DOM document.
static java.lang.String getLink(org.w3c.dom.Element node)
          This method is the Java equivalent to the template with mode="util.getLink" defined in the util.xsl stylesheet.
static java.lang.String getTextValue(org.w3c.dom.Node node)
          This utility method retrieves the text value from a DOM Node.
static org.w3c.dom.Document parse(java.io.InputStream in)
          This method creates an XML document from the contents of an InputStream.
static void printHtml(java.io.Writer out, org.w3c.dom.Document doc)
          This method streams an XML document with method="html" into a Writer object.
static void printXml(java.io.Writer out, org.w3c.dom.Document doc)
          This method streams an XML document with method="xml" into a Writer object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDocument

public static org.w3c.dom.Document createDocument()
                                           throws XmlException
This method creates a new DOM document.

Returns:
A new DOM document
Throws:
XmlException

printHtml

public static void printHtml(java.io.Writer out,
                             org.w3c.dom.Document doc)
                      throws java.io.IOException
This method streams an XML document with method="html" into a Writer object.

Parameters:
out - The Writer object to which the contents of the document are written.
doc - The XML document to be streamed to the Writer
Throws:
java.io.IOException

printXml

public static void printXml(java.io.Writer out,
                            org.w3c.dom.Document doc)
                     throws java.io.IOException
This method streams an XML document with method="xml" into a Writer object.

Parameters:
out - The Writer object to which the contents of the document are written.
doc - The XML document to be streamed to the Writer
Throws:
java.io.IOException

parse

public static org.w3c.dom.Document parse(java.io.InputStream in)
                                  throws XmlException
This method creates an XML document from the contents of an InputStream.

Parameters:
in - The InputStream parsed by this method
Returns:
An XML Document object with the contents of the InputStream
Throws:
XmlException

getLink

public static java.lang.String getLink(org.w3c.dom.Element node)
This method is the Java equivalent to the template with mode="util.getLink" defined in the util.xsl stylesheet. It creates a name for an XML element which can be used for interlinking parts of the documentation. Unlike the links between element summary descriptions and their detailed descriptions (which are created by simply numbering the nodes in the order of occurrence), this template creates a name from all the element's attributes by concatenating the element name with a sequence of all attribute names and values, separated by a tilde (~), with the attribute names sorted alphabetically and blanks in the attribute values omitted.
Example: The return value of this template for a the element
<myNode yourAttr="attr one" ourAttr="attr two"/>
is myNode~outAttr~attrtwo~yourAttr~attrone

Parameters:
node - The DOM Node for which the link name is to be constructed
Returns:
The link name of the given DOM Node

getTextValue

public static java.lang.String getTextValue(org.w3c.dom.Node node)
This utility method retrieves the text value from a DOM Node.

Parameters:
node - The node whose text value is to be retrieved
Returns:
The given Node's text value

XDC - v. 0.6.1