com.objectwave.templateMerge
Class JspStyleRead

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--com.objectwave.templateMerge.JspStyleRead
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class JspStyleRead
extends org.xml.sax.helpers.DefaultHandler

Used to parse an XML file.

Version:
$Id: JspStyleRead.java,v 2.2 2002/08/12 22:26:40 dave_hoag Exp $
Author:
Zhou Cai

Nested Class Summary
static class JspStyleRead.Test
          Unit Test
 
Constructor Summary
JspStyleRead()
          Constructor for the JspStyleRead object
JspStyleRead(java.io.Reader input)
          Constructor
JspStyleRead(java.lang.String uri)
          Constructor
 
Method Summary
 void characters(char[] ch, int start, int length)
          This method will read the characters in an XML document.
 void endElement(java.lang.String uri, java.lang.String local, java.lang.String raw)
          This method will parse the collection in an XML document.
protected  java.util.Vector getBody(java.lang.String body)
          read a string line by line and write them into a vector
 KnownTemplates getTemplates()
          Get the KnowTemplates which has all information in the XML file
protected  void initialize()
           
protected  void parse(org.xml.sax.InputSource uri)
          Parse the XML
protected  void parse(java.lang.String uri)
          Parse the XML
protected  void setSubTemplate()
          set the sub templates for the current template
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String raw, org.xml.sax.Attributes attrs)
          This method will parse a single element in an XML document.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JspStyleRead

public JspStyleRead(java.lang.String uri)
             throws ConfigurationException
Constructor

Parameters:
uri - String the XML file name
Throws:
ConfigurationException

JspStyleRead

public JspStyleRead(java.io.Reader input)
             throws ConfigurationException
Constructor

Parameters:
input - Reader
Throws:
ConfigurationException

JspStyleRead

public JspStyleRead()
Constructor for the JspStyleRead object

Method Detail

getTemplates

public KnownTemplates getTemplates()
Get the KnowTemplates which has all information in the XML file

Returns:
KnownTemplates

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String raw,
                         org.xml.sax.Attributes attrs)
This method will parse a single element in an XML document. It is called automatically by the XML Parser.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - String The Namespace URI
local - String The local name (without prefix)
raw - String The raw XML 1.0 name (with prefix)
attrs - Attributes The attributes attached to the element.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String local,
                       java.lang.String raw)
This method will parse the collection in an XML document. It is called automatically by the XML Parser.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri - String The Namespace URI
local - String The local name (without prefix)
raw - String The raw XML 1.0 name (with prefix)

characters

public void characters(char[] ch,
                       int start,
                       int length)
This method will read the characters in an XML document. It is called automatically by the XML Parser.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Parameters:
ch - char array The characters from the XML document.
start - integer The start position in the array.
length - integer The number of characters to read from the array

setSubTemplate

protected void setSubTemplate()
set the sub templates for the current template


getBody

protected java.util.Vector getBody(java.lang.String body)
                            throws java.io.IOException
read a string line by line and write them into a vector

Parameters:
body - String the string to be read
Returns:
Vector
Throws:
java.io.IOException

initialize

protected void initialize()

parse

protected void parse(java.lang.String uri)
              throws ConfigurationException
Parse the XML

Parameters:
uri - The XML file name
Throws:
ConfigurationException - If any error happen in the XML file processing

parse

protected void parse(org.xml.sax.InputSource uri)
              throws ConfigurationException
Parse the XML

Parameters:
uri - The input source of the XML data.
Throws:
ConfigurationException - If any error happen in the XML file processing