org.apache.turbine.services.intake.transform
Class XmlToAppData

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended byorg.apache.turbine.services.intake.transform.XmlToAppData
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

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

A Class that is used to parse an input xml schema file and creates and AppData java structure. It uses apache Xerces to do the xml parsing.

Version:
$Id: XmlToAppData.java 534527 2007-05-02 16:10:59Z tv $
Author:
John McNally, Henning P. Schmiedehausen, Quinton McCombs

Constructor Summary
XmlToAppData()
          Creates a new instance of the Intake XML Parser
 
Method Summary
 void characters(char[] mesgArray, int start, int length)
          Handles the character data, which we are using to specify the error message.
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName)
          Handles closing Elements of the XML file
 void error(org.xml.sax.SAXParseException spe)
          Callback function for the xml parser to give errors.
 void fatalError(org.xml.sax.SAXParseException spe)
          Callback function for the xml parser to give fatalErrors.
 AppData parseFile(java.lang.String xmlFile)
          Parses a XML input file and returns a newly created and populated AppData structure.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          EntityResolver implementation.
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes attributes)
          Handles opening elements of the xml file.
 void warning(org.xml.sax.SAXParseException spe)
          Callback function for the xml parser to give warnings.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlToAppData

public XmlToAppData()
Creates a new instance of the Intake XML Parser

Method Detail

parseFile

public AppData parseFile(java.lang.String xmlFile)
                  throws javax.xml.parsers.ParserConfigurationException,
                         org.xml.sax.SAXException,
                         java.io.IOException
Parses a XML input file and returns a newly created and populated AppData structure.

Parameters:
xmlFile - The input file to parse.
Returns:
AppData populated by xmlFile.
Throws:
javax.xml.parsers.ParserConfigurationException - When a serious parser configuration problem occurs.
org.xml.sax.SAXException - When a problem parsing the XML file occurs.
java.io.IOException - When an I/O error occurs.

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
EntityResolver implementation. Called by the XML parser

Parameters:
publicId - The public identifer, which might be null.
systemId - The system identifier provided in the XML document.
Returns:
an InputSource for the database.dtd file

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String rawName,
                         org.xml.sax.Attributes attributes)
Handles opening elements of the xml file.

Parameters:
uri - The current namespace URI.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
rawName - The qualified name (with prefix), or the empty string if qualified names are not available.
attributes - The specified or defaulted attributes.

characters

public void characters(char[] mesgArray,
                       int start,
                       int length)
Handles the character data, which we are using to specify the error message.

Parameters:
mesgArray - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String rawName)
Handles closing Elements of the XML file

Parameters:
uri - The current namespace URI.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
rawName - The qualified name (with prefix), or the empty string if qualified names are not available.

warning

public void warning(org.xml.sax.SAXParseException spe)
Callback function for the xml parser to give warnings.

Parameters:
spe - a SAXParseException value

error

public void error(org.xml.sax.SAXParseException spe)
Callback function for the xml parser to give errors.

Parameters:
spe - a SAXParseException value

fatalError

public void fatalError(org.xml.sax.SAXParseException spe)
Callback function for the xml parser to give fatalErrors.

Parameters:
spe - a SAXParseException value


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