org.apache.jasper.parser
Class ParserUtils

java.lang.Object
  |
  +--org.apache.jasper.parser.ParserUtils

public class ParserUtils
extends java.lang.Object

XML parsing utilities for processing web application deployment descriptor and tag library descriptor files. FIXME - make these use a separate class loader for the parser to be used.

Version:
$Revision: 1.4.2.1 $ $Date: 2002/05/20 17:47:00 $
Author:
Craig R. McClanahan

Field Summary
protected  java.lang.ClassLoader classLoader
          The class loader to use for accessing our XML parser.
protected  org.xml.sax.EntityResolver entityResolver
          An entity resolver for use when parsing XML documents.
protected  org.xml.sax.ErrorHandler errorHandler
          An error handler for use when parsing XML documents.
 
Constructor Summary
ParserUtils()
           
 
Method Summary
protected  TreeNode convert(TreeNode parent, org.w3c.dom.Node node)
          Create and return a TreeNode that corresponds to the specified Node, including processing all of the attributes and children nodes.
static java.lang.ClassLoader createClassLoader(java.lang.ClassLoader parentLoader)
          Construct (if necessary) and return a class loader that has been configured with the specified parent class loader, and repositories as needed to access the required XML parser.
static ParserUtils createParserUtils(java.lang.ClassLoader parentLoader)
          Create (if necessary) and return an instance of ParserUtils that has been loaded by our subordinate class loader (and therefore should have access to the XML parser that is visible to repositories of that class loader).
 java.lang.ClassLoader getClassLoader()
          Return the class loader used to access our XML parser.
static void main(java.lang.String[] args)
          Usage: java org.apache.jasper.parser.ParserUtils {pathname}
 TreeNode parseXMLDocument(java.lang.String uri, java.io.InputStream is)
          Parse the specified XML document, and return a TreeNode that corresponds to the root node of the document tree.
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the class loader used to access our XML parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classLoader

protected java.lang.ClassLoader classLoader
The class loader to use for accessing our XML parser.


errorHandler

protected org.xml.sax.ErrorHandler errorHandler
An error handler for use when parsing XML documents.


entityResolver

protected org.xml.sax.EntityResolver entityResolver
An entity resolver for use when parsing XML documents.

Constructor Detail

ParserUtils

public ParserUtils()
Method Detail

main

public static void main(java.lang.String[] args)
Usage: java org.apache.jasper.parser.ParserUtils {pathname}


getClassLoader

public java.lang.ClassLoader getClassLoader()
Return the class loader used to access our XML parser.


parseXMLDocument

public TreeNode parseXMLDocument(java.lang.String uri,
                                 java.io.InputStream is)
                          throws JasperException
Parse the specified XML document, and return a TreeNode that corresponds to the root node of the document tree.

Parameters:
uri - URI of the XML document being parsed
is - Input stream containing the deployment descriptor
Throws:
JasperException - if an input/output error occurs
JasperException - if a parsing error occurs

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader used to access our XML parser.

Parameters:
classLoader - The new class loader

convert

protected TreeNode convert(TreeNode parent,
                           org.w3c.dom.Node node)
Create and return a TreeNode that corresponds to the specified Node, including processing all of the attributes and children nodes.

Parameters:
parent - The parent TreeNode (if any) for the new TreeNode
node - The XML document Node to be converted

createParserUtils

public static ParserUtils createParserUtils(java.lang.ClassLoader parentLoader)
Create (if necessary) and return an instance of ParserUtils that has been loaded by our subordinate class loader (and therefore should have access to the XML parser that is visible to repositories of that class loader).

Parameters:
parentLoader - The web application class loader

createClassLoader

public static java.lang.ClassLoader createClassLoader(java.lang.ClassLoader parentLoader)
                                               throws java.net.MalformedURLException
Construct (if necessary) and return a class loader that has been configured with the specified parent class loader, and repositories as needed to access the required XML parser.

Parameters:
parentLoader - The web application class loader
Throws:
java.net.MalformedURLException - if we cannot create a valid URL for one of the required repositories


Copyright © 2000 Apache Software Foundation. All Rights Reserved.