net.larsan.urd.util
Class XMLUtils

java.lang.Object
  |
  +--net.larsan.urd.util.XMLUtils

public class XMLUtils
extends java.lang.Object

Some static XML DOM util methods

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Constructor Summary
XMLUtils()
           
 
Method Summary
static java.util.Properties copyAttributeProperties(org.w3c.dom.Node node)
          Take a node and copy it's attributes into a property object.
static org.w3c.dom.Document parse(java.io.File file)
          Parse a document from a file.
static org.w3c.dom.Document parse(java.io.InputStream in)
          Parse a document from an input stream.
static org.w3c.dom.Document parseString(java.lang.String string)
          Parse a document from a String.
static void transform(java.io.InputStream xslSource, java.io.InputStream xmlSource, java.io.OutputStream out)
          Apply a transformation on an input stream XML source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtils

public XMLUtils()
Method Detail

parse

public static org.w3c.dom.Document parse(java.io.InputStream in)
                                  throws XMLException
Parse a document from an input stream.

Parameters:
in - InputStream to parse
Returns:
A Document from the iinput stream
Throws:
XMLException - If any errors occur while parsing

parse

public static org.w3c.dom.Document parse(java.io.File file)
                                  throws XMLException
Parse a document from a file.

Parameters:
file - File to parse
Returns:
A Document from the file
Throws:
XMLException - If any errors occur while parsing

parseString

public static org.w3c.dom.Document parseString(java.lang.String string)
                                        throws XMLException
Parse a document from a String.

Parameters:
string - String XML
Returns:
A Document from the string
Throws:
XMLException - If any errors occur while parsing

copyAttributeProperties

public static java.util.Properties copyAttributeProperties(org.w3c.dom.Node node)
Take a node and copy it's attributes into a property object.

Parameters:
node - Node to copy attributes from
Returns:
A property object with the node's attributes

transform

public static void transform(java.io.InputStream xslSource,
                             java.io.InputStream xmlSource,
                             java.io.OutputStream out)
                      throws XMLException
Apply a transformation on an input stream XML source. This will read the an XSL source, apply it to the XML source and write the result to the output stream

Parameters:
xslSource - XSL source stream
xmlSource - XML source stream
out - Transformation output stream
Throws:
XMLException - On transformation or I/O errors