org.openlca.dataconversion
Class LCADocumentBuilder

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.openlca.dataconversion.LCADocumentBuilder
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

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

Builds LCADocument objects from XML files. Extends DefaultHandler.

Version:
1.0
Author:
Michael Srocka, GreenDeltaTC, for the openLCA project (www.openlca.org)

Constructor Summary
LCADocumentBuilder()
          Creates a new instance of LCADocumentBuilder.
LCADocumentBuilder(javax.xml.parsers.SAXParser parser)
          Creates a new instance of LCADocumentBuilder.
 
Method Summary
 void characters(char[] chars, int start, int end)
           
 LCADocument getLCADocument(java.io.File file)
          Returns an LCADocument from a given file.
 java.util.List<LCADocument> getLCADocuments(java.io.File[] files)
          Returns a list of LCA documents from an file array.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LCADocumentBuilder

public LCADocumentBuilder()
                   throws javax.xml.parsers.ParserConfigurationException,
                          org.xml.sax.SAXException
Creates a new instance of LCADocumentBuilder.

Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

LCADocumentBuilder

public LCADocumentBuilder(javax.xml.parsers.SAXParser parser)
Creates a new instance of LCADocumentBuilder.

Parameters:
parser - possible object is SAXParser.
Method Detail

characters

public void characters(char[] chars,
                       int start,
                       int end)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

getLCADocument

public LCADocument getLCADocument(java.io.File file)
                           throws org.xml.sax.SAXException,
                                  java.io.IOException,
                                  ConverterException
Returns an LCADocument from a given file.

Parameters:
file - Allowed object is an (XML) File.
Returns:
Possible object is LCADocument.
Throws:
org.xml.sax.SAXException
java.io.IOException
ConverterException

getLCADocuments

public java.util.List<LCADocument> getLCADocuments(java.io.File[] files)
                                            throws org.xml.sax.SAXException,
                                                   java.io.IOException
Returns a list of LCA documents from an file array.

Parameters:
files - File array with XML documents.
Returns:
possible object is a list of LCADocument.
Throws:
java.io.IOException
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String qname,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException