com.thaiopensource.validate.xerces
Class ValidatorImpl

java.lang.Object
  extended by org.apache.xerces.util.ParserConfigurationSettings
      extended by com.thaiopensource.validate.xerces.ValidatorImpl
All Implemented Interfaces:
Validator, org.apache.xerces.impl.validation.EntityState, org.apache.xerces.xni.parser.XMLComponentManager, org.apache.xerces.xni.parser.XMLEntityResolver, org.apache.xerces.xni.XMLLocator, ContentHandler, DTDHandler

 class ValidatorImpl
extends org.apache.xerces.util.ParserConfigurationSettings
implements Validator, ContentHandler, DTDHandler, org.apache.xerces.xni.XMLLocator, org.apache.xerces.xni.parser.XMLEntityResolver, org.apache.xerces.impl.validation.EntityState


Field Summary
private  org.apache.xerces.xni.XMLAttributes attributes
           
private  org.apache.xerces.xni.parser.XMLComponent[] components
           
private  org.apache.xerces.impl.XMLEntityManager entityManager
           
private  Hashtable entityTable
           
private  org.apache.xerces.impl.XMLErrorReporter errorReporter
           
private  Locator locator
           
private  org.apache.xerces.xni.NamespaceContext namespaceContext
           
private  boolean pushedContext
           
private static String[] recognizedFeatures
           
private static String[] recognizedProperties
           
private  org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator
           
private  org.apache.xerces.util.SymbolTable symbolTable
           
private  org.apache.xerces.impl.validation.ValidationManager validationManager
           
 
Fields inherited from class org.apache.xerces.util.ParserConfigurationSettings
fFeatures, fParentSettings, fProperties, fRecognizedFeatures, fRecognizedProperties, PARSER_SETTINGS
 
Constructor Summary
ValidatorImpl(org.apache.xerces.util.SymbolTable symbolTable, org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool, PropertyMap properties)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(String namespaceURI, String localName, String qName)
           
 void endPrefixMapping(String prefix)
           
 String getBaseSystemId()
           
 int getCharacterOffset()
          This is needed by the Xerces 2.7.0 - we do not include it yet as it is not yet released but made an integration from CVS some time ago.
 int getColumnNumber()
           
 ContentHandler getContentHandler()
          Returns the ContentHandler that will receive the XML document.
 DTDHandler getDTDHandler()
          Returns a DTDHandler.
 String getEncoding()
           
 String getExpandedSystemId()
           
 int getLineNumber()
           
 String getLiteralSystemId()
           
 String getPublicId()
           
 String getXMLVersion()
          This is needed by the Xerces 2.7.0 - we do not include it yet as it is not yet released but made an integration from CVS some time ago.
 void ignorableWhitespace(char[] ch, int start, int length)
           
 boolean isEntityDeclared(String name)
           
 boolean isEntityUnparsed(String name)
           
private  org.apache.xerces.xni.QName makeQName(String namespaceURI, String localName, String qName)
           
 void notationDecl(String name, String publicId, String systemId)
           
 void processingInstruction(String target, String data)
           
 void reset()
          Cleans up after validating a document.
 org.apache.xerces.xni.parser.XMLInputSource resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier resourceIdentifier)
           
 void setDocumentLocator(Locator locator)
           
 void skippedEntity(String name)
           
 void startDocument()
           
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
           
 void startPrefixMapping(String prefix, String uri)
           
(package private) static SAXException toSAXException(org.apache.xerces.xni.XNIException e)
           
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
           
 
Methods inherited from class org.apache.xerces.util.ParserConfigurationSettings
addRecognizedFeatures, addRecognizedProperties, checkFeature, checkProperty, getFeature, getProperty, setFeature, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaValidator

private final org.apache.xerces.impl.xs.XMLSchemaValidator schemaValidator

errorReporter

private final org.apache.xerces.impl.XMLErrorReporter errorReporter

entityManager

private final org.apache.xerces.impl.XMLEntityManager entityManager

validationManager

private final org.apache.xerces.impl.validation.ValidationManager validationManager

namespaceContext

private final org.apache.xerces.xni.NamespaceContext namespaceContext

attributes

private final org.apache.xerces.xni.XMLAttributes attributes

symbolTable

private final org.apache.xerces.util.SymbolTable symbolTable

components

private final org.apache.xerces.xni.parser.XMLComponent[] components

locator

private Locator locator

entityTable

private final Hashtable entityTable

pushedContext

private boolean pushedContext

recognizedFeatures

private static final String[] recognizedFeatures

recognizedProperties

private static final String[] recognizedProperties
Constructor Detail

ValidatorImpl

ValidatorImpl(org.apache.xerces.util.SymbolTable symbolTable,
              org.apache.xerces.xni.grammars.XMLGrammarPool grammarPool,
              PropertyMap properties)
Method Detail

reset

public void reset()
Description copied from interface: Validator
Cleans up after validating a document. After completing validation of a document, reset must be called. After calling reset(), another document may be validated. Calling this method may create new ContentHandler and DTDHandler objects or may simply reinitialize the state of the existing objects.

Specified by:
reset in interface Validator

getContentHandler

public ContentHandler getContentHandler()
Description copied from interface: Validator
Returns the ContentHandler that will receive the XML document. Information about the XML document to be validated must be reported by calling methods on the returned ContentHandler. When validation of an XML document has been completed (either endDocument() has been called or validation has been abandoned prematurely), reset() must be called. If no calls are made on the ContentHandler, then reset() need not be called. Implementations should allocate resources that require cleanup (e.g. threads, open files) lazily, typically in startDocument(). This method does not change the state of the Validator: the same object will always be returned unless reset is called.

Specified by:
getContentHandler in interface Validator
Returns:
a ContentHandler, never null
See Also:
Validator.reset()

getDTDHandler

public DTDHandler getDTDHandler()
Description copied from interface: Validator
Returns a DTDHandler. Information about the DTD must be reported by calling methods on the returned object, unless null is returned. The same object will always be returned unless reset is called: this method does not change the state of the Validator.

Specified by:
getDTDHandler in interface Validator
Returns:
a DTDHandler, maybe null if DTD information is not significant to the Validator

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
Specified by:
notationDecl in interface DTDHandler

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
Specified by:
unparsedEntityDecl in interface DTDHandler

isEntityDeclared

public boolean isEntityDeclared(String name)
Specified by:
isEntityDeclared in interface org.apache.xerces.impl.validation.EntityState

isEntityUnparsed

public boolean isEntityUnparsed(String name)
Specified by:
isEntityUnparsed in interface org.apache.xerces.impl.validation.EntityState

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

makeQName

private org.apache.xerces.xni.QName makeQName(String namespaceURI,
                                              String localName,
                                              String qName)

resolveEntity

public org.apache.xerces.xni.parser.XMLInputSource resolveEntity(org.apache.xerces.xni.XMLResourceIdentifier resourceIdentifier)
                                                          throws org.apache.xerces.xni.XNIException,
                                                                 IOException
Specified by:
resolveEntity in interface org.apache.xerces.xni.parser.XMLEntityResolver
Throws:
org.apache.xerces.xni.XNIException
IOException

getPublicId

public String getPublicId()
Specified by:
getPublicId in interface org.apache.xerces.xni.XMLLocator

getEncoding

public String getEncoding()
Specified by:
getEncoding in interface org.apache.xerces.xni.XMLLocator

getBaseSystemId

public String getBaseSystemId()
Specified by:
getBaseSystemId in interface org.apache.xerces.xni.XMLLocator

getLiteralSystemId

public String getLiteralSystemId()
Specified by:
getLiteralSystemId in interface org.apache.xerces.xni.XMLLocator

getExpandedSystemId

public String getExpandedSystemId()
Specified by:
getExpandedSystemId in interface org.apache.xerces.xni.XMLLocator

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface org.apache.xerces.xni.XMLLocator

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface org.apache.xerces.xni.XMLLocator

toSAXException

static SAXException toSAXException(org.apache.xerces.xni.XNIException e)

getCharacterOffset

public int getCharacterOffset()
This is needed by the Xerces 2.7.0 - we do not include it yet as it is not yet released but made an integration from CVS some time ago. When reverting to 2.6.2 the method remained here as we will neet it when we will get back to 2.7.0.

Specified by:
getCharacterOffset in interface org.apache.xerces.xni.XMLLocator
See Also:
XMLLocator.getCharacterOffset()

getXMLVersion

public String getXMLVersion()
This is needed by the Xerces 2.7.0 - we do not include it yet as it is not yet released but made an integration from CVS some time ago. When reverting to 2.6.2 the method remained here as we will neet it when we will get back to 2.7.0.

Specified by:
getXMLVersion in interface org.apache.xerces.xni.XMLLocator
See Also:
XMLLocator.getXMLVersion()