com.thaiopensource.relaxng.impl
Class PatternValidator

java.lang.Object
  extended bycom.thaiopensource.relaxng.parse.sax.DtdContext
      extended bycom.thaiopensource.relaxng.impl.PatternValidator
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, ValidationContext, Validator

public class PatternValidator
extends DtdContext
implements Validator, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler


Constructor Summary
PatternValidator(Pattern pattern, ValidatorPatternBuilder builder, org.xml.sax.ErrorHandler eh)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 java.lang.String getBaseUri()
          Returns the base URI of the context.
 org.xml.sax.ContentHandler getContentHandler()
          Returns the ContentHandler that will receive the XML document.
 org.xml.sax.DTDHandler getDTDHandler()
          Returns a DTDHandler.
 void ignorableWhitespace(char[] ch, int start, int len)
           
 void processingInstruction(java.lang.String target, java.lang.String date)
           
 void reset()
          Cleans up after validating a document.
 java.lang.String resolveNamespacePrefix(java.lang.String prefix)
          Resolves a namespace prefix to the corresponding namespace URI.
 void setDocumentLocator(org.xml.sax.Locator loc)
           
 void skippedEntity(java.lang.String name)
           
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class com.thaiopensource.relaxng.parse.sax.DtdContext
clearDtdContext, isNotation, isUnparsedEntity, notationDecl, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.DTDHandler
notationDecl, unparsedEntityDecl
 

Constructor Detail

PatternValidator

public PatternValidator(Pattern pattern,
                        ValidatorPatternBuilder builder,
                        org.xml.sax.ErrorHandler eh)
Method Detail

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

characters

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

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator loc)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String date)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int len)
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

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 org.xml.sax.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 org.xml.sax.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

resolveNamespacePrefix

public java.lang.String resolveNamespacePrefix(java.lang.String prefix)
Description copied from interface: ValidationContext
Resolves a namespace prefix to the corresponding namespace URI. This method is used for validating the QName type, for example.

If the prefix is "" (empty string), it indicates an unprefixed value. The callee should resolve it as for an unprefixed element, rather than for an unprefixed attribute.

If the prefix is "xml", then the callee must resolve this prefix into "http://www.w3.org/XML/1998/namespace", as defined in the XML Namespaces Recommendation.

Specified by:
resolveNamespacePrefix in interface ValidationContext
Returns:
namespace URI of this prefix. If the specified prefix is not declared, the implementation must return null.

getBaseUri

public java.lang.String getBaseUri()
Description copied from interface: ValidationContext
Returns the base URI of the context. The null string may be returned if no base URI is known.

Specified by:
getBaseUri in interface ValidationContext