org.apache.cactus.integration.ant.deployment
Class WebXmlIo

java.lang.Object
  extended byorg.apache.cactus.integration.ant.deployment.WebXmlIo

public class WebXmlIo
extends java.lang.Object

Provides convenience methods for reading and writing web deployment descriptors.

Since:
Cactus 1.5
Version:
$Id: WebXmlIo.java,v 1.4 2003/06/29 14:57:53 cmlenz Exp $
Author:
Christopher Lenz

Constructor Summary
WebXmlIo()
           
 
Method Summary
static WebXml newWebXml(WebXmlVersion theVersion)
          Creates a new empty deployment descriptor.
static WebXml parseWebXml(java.io.InputStream theInput, org.xml.sax.EntityResolver theEntityResolver)
          Parses a deployment descriptor provided as input stream.
static WebXml parseWebXmlFromFile(java.io.File theFile, org.xml.sax.EntityResolver theEntityResolver)
          Parses a deployment descriptor stored in a regular file.
static void writeWebXml(WebXml theWebXml, java.io.File theFile)
          Writes the specified document to a file.
static void writeWebXml(WebXml theWebXml, java.io.File theFile, java.lang.String theEncoding)
          Writes the specified document to a file.
static void writeWebXml(WebXml theWebXml, java.io.File theFile, java.lang.String theEncoding, boolean isIndent)
          Writes the specified document to a file.
static void writeWebXml(WebXml theWebXml, java.io.OutputStream theOutput, java.lang.String theEncoding, boolean isIndent)
          Writes the specified document to an output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebXmlIo

public WebXmlIo()
Method Detail

newWebXml

public static WebXml newWebXml(WebXmlVersion theVersion)
                        throws javax.xml.parsers.ParserConfigurationException
Creates a new empty deployment descriptor.

Parameters:
theVersion - The version of the descriptor to create
Returns:
The new descriptor
Throws:
javax.xml.parsers.ParserConfigurationException - If the XML parser was not correctly configured

parseWebXmlFromFile

public static WebXml parseWebXmlFromFile(java.io.File theFile,
                                         org.xml.sax.EntityResolver theEntityResolver)
                                  throws org.xml.sax.SAXException,
                                         javax.xml.parsers.ParserConfigurationException,
                                         java.io.IOException
Parses a deployment descriptor stored in a regular file.

Parameters:
theFile - The file to parse
theEntityResolver - A SAX entity resolver, or null to use the default
Returns:
The parsed descriptor
Throws:
org.xml.sax.SAXException - If the file could not be parsed
javax.xml.parsers.ParserConfigurationException - If the XML parser was not correctly configured
java.io.IOException - If an I/O error occurs

parseWebXml

public static WebXml parseWebXml(java.io.InputStream theInput,
                                 org.xml.sax.EntityResolver theEntityResolver)
                          throws org.xml.sax.SAXException,
                                 javax.xml.parsers.ParserConfigurationException,
                                 java.io.IOException
Parses a deployment descriptor provided as input stream.

Parameters:
theInput - The input stream
theEntityResolver - A SAX entity resolver, or null to use the default
Returns:
The parsed descriptor
Throws:
org.xml.sax.SAXException - If the input could not be parsed
javax.xml.parsers.ParserConfigurationException - If the XML parser was not correctly configured
java.io.IOException - If an I/O error occurs

writeWebXml

public static void writeWebXml(WebXml theWebXml,
                               java.io.File theFile)
                        throws java.io.IOException
Writes the specified document to a file.

Parameters:
theWebXml - The descriptor to serialize
theFile - The file to write to
Throws:
java.io.IOException - If an I/O error occurs

writeWebXml

public static void writeWebXml(WebXml theWebXml,
                               java.io.File theFile,
                               java.lang.String theEncoding)
                        throws java.io.IOException
Writes the specified document to a file.

Parameters:
theWebXml - The descriptor to serialize
theFile - The file to write to
theEncoding - The character encoding to use
Throws:
java.io.IOException - If an I/O error occurs

writeWebXml

public static void writeWebXml(WebXml theWebXml,
                               java.io.File theFile,
                               java.lang.String theEncoding,
                               boolean isIndent)
                        throws java.io.IOException
Writes the specified document to a file.

Parameters:
theWebXml - The descriptor to serialize
theFile - The file to write to
theEncoding - The character encoding to use
isIndent - Whether the written XML should be indented
Throws:
java.io.IOException - If an I/O error occurs

writeWebXml

public static void writeWebXml(WebXml theWebXml,
                               java.io.OutputStream theOutput,
                               java.lang.String theEncoding,
                               boolean isIndent)
                        throws java.io.IOException
Writes the specified document to an output stream.

Parameters:
theWebXml - The descriptor to serialize
theOutput - The output stream to write to
theEncoding - The character encoding to use
isIndent - Whether the written XML should be indented
Throws:
java.io.IOException - If an I/O error occurs


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.