com.aptana.sax
Class ValidatingReader

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.aptana.sax.ValidatingReader
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
ColorizerReader, Dreamweaver8SiteImporter, MetadataReader, RegexLexerBuilderBase, SchemaBuilder, ScriptDocReader

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

Author:
Kevin Lindsey

Field Summary
protected  Schema _schema
          The schema associated with this reader
 
Constructor Summary
protected ValidatingReader()
          Create a new instance of ValidatingReader
  ValidatingReader(Schema schema)
          Create a new instance of ValidatingReader
 
Method Summary
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)
          Finish processing the specified element
 void read(java.io.InputStream in)
          Load an XML stream and validate it against this reader's schema
 void read(java.lang.String filename)
          Load a xml file and validate it against this reader's schema
 void startDocument()
          startDocument handler
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName, org.xml.sax.Attributes attributes)
          Handle the start of a new element
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_schema

protected Schema _schema
The schema associated with this reader

Constructor Detail

ValidatingReader

protected ValidatingReader()
Create a new instance of ValidatingReader


ValidatingReader

public ValidatingReader(Schema schema)
Create a new instance of ValidatingReader

Parameters:
schema - The schema to associate with this reader.
Method Detail

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qualifiedName)
                throws org.xml.sax.SAXException
Finish processing the specified element

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI -
localName -
qualifiedName -
Throws:
org.xml.sax.SAXException

read

public void read(java.lang.String filename)
          throws javax.xml.parsers.ParserConfigurationException,
                 org.xml.sax.SAXException,
                 java.io.IOException
Load a xml file and validate it against this reader's schema

Parameters:
filename - The name of the xml file to load and validate
Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException

read

public void read(java.io.InputStream in)
          throws javax.xml.parsers.ParserConfigurationException,
                 org.xml.sax.SAXException,
                 java.io.IOException
Load an XML stream and validate it against this reader's schema

Parameters:
in - The input stream that contains XML
Throws:
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
startDocument handler

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qualifiedName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Handle the start of a new element

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
namespaceURI - The element's namespace URI
localName - The element's local name
qualifiedName - The element's qualified name
attributes - The element's attributes
Throws:
org.xml.sax.SAXException