Package com.sun.msv.verifier
Class AbstractVerifier
- java.lang.Object
-
- com.sun.msv.verifier.AbstractVerifier
-
- All Implemented Interfaces:
IDContextProvider2
,org.relaxng.datatype.ValidationContext
,ContentHandler
,DTDHandler
- Direct Known Subclasses:
Verifier
public abstract class AbstractVerifier extends Object implements ContentHandler, DTDHandler, IDContextProvider2
Base implementation for various Verifier implementations. This implementation provides common service like:- collecting ID/IDREFs.
- storing Locator.
By setting
performIDcheck
variable, the ID/IDREF checking can be either turned on or turned off.
- Author:
- Kohsuke KAWAGUCHI
-
-
Field Summary
Fields Modifier and Type Field Description protected static Locator
dummyLocator
protected Set
idrefs
this map remembers every IDREF token encountered in this documentprotected Map
ids
this map remembers every ID token encountered in this documentprotected Locator
locator
Document Locator that is given by XML reader.protected NamespaceSupport
namespaceSupport
namespace prefix to namespace URI resolver.protected boolean
performIDcheck
set this flag to true to perform ID/IDREF validation.
-
Constructor Summary
Constructors Constructor Description AbstractVerifier()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
endElement(String namespaceUri, String localName, String qName)
void
endPrefixMapping(String prefix)
String
getBaseUri()
Locator
getLocator()
protected void
init()
boolean
isNotation(String notationName)
boolean
isUnparsedEntity(String entityName)
void
notationDecl(String name, String publicId, String systemId)
protected abstract void
onDuplicateId(String id)
this method is called when a duplicate id value is found.void
onID(org.relaxng.datatype.Datatype dt, StringToken token)
this method is called when a type with ID semantics is matched.void
processingInstruction(String name, String data)
String
resolveNamespacePrefix(String prefix)
void
setDocumentLocator(Locator loc)
void
skippedEntity(String p)
void
startElement(String namespaceUri, String localName, String qName, Attributes atts)
void
startPrefixMapping(String prefix, String uri)
void
unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
-
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.ContentHandler
characters, endDocument, ignorableWhitespace, startDocument
-
-
-
-
Field Detail
-
locator
protected Locator locator
Document Locator that is given by XML reader. Sometimes it doesn't set the locator, so start with a dummy instance.
-
dummyLocator
protected static final Locator dummyLocator
-
performIDcheck
protected boolean performIDcheck
set this flag to true to perform ID/IDREF validation. this value cannot be modified in the middle of the validation.
-
ids
protected final Map ids
this map remembers every ID token encountered in this document
-
idrefs
protected final Set idrefs
this map remembers every IDREF token encountered in this document
-
namespaceSupport
protected final NamespaceSupport namespaceSupport
namespace prefix to namespace URI resolver. this object memorizes mapping information.
-
-
Method Detail
-
getLocator
public final Locator getLocator()
-
setDocumentLocator
public void setDocumentLocator(Locator loc)
- Specified by:
setDocumentLocator
in interfaceContentHandler
-
skippedEntity
public void skippedEntity(String p)
- Specified by:
skippedEntity
in interfaceContentHandler
-
processingInstruction
public void processingInstruction(String name, String data)
- Specified by:
processingInstruction
in interfaceContentHandler
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri)
- Specified by:
startPrefixMapping
in interfaceContentHandler
-
endPrefixMapping
public void endPrefixMapping(String prefix)
- Specified by:
endPrefixMapping
in interfaceContentHandler
-
startElement
public void startElement(String namespaceUri, String localName, String qName, Attributes atts) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Throws:
SAXException
-
endElement
public void endElement(String namespaceUri, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Throws:
SAXException
-
init
protected void init()
-
notationDecl
public void notationDecl(String name, String publicId, String systemId)
- Specified by:
notationDecl
in interfaceDTDHandler
-
unparsedEntityDecl
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
- Specified by:
unparsedEntityDecl
in interfaceDTDHandler
-
resolveNamespacePrefix
public String resolveNamespacePrefix(String prefix)
- Specified by:
resolveNamespacePrefix
in interfaceorg.relaxng.datatype.ValidationContext
-
isUnparsedEntity
public boolean isUnparsedEntity(String entityName)
- Specified by:
isUnparsedEntity
in interfaceorg.relaxng.datatype.ValidationContext
-
isNotation
public boolean isNotation(String notationName)
- Specified by:
isNotation
in interfaceorg.relaxng.datatype.ValidationContext
-
getBaseUri
public String getBaseUri()
- Specified by:
getBaseUri
in interfaceorg.relaxng.datatype.ValidationContext
-
onDuplicateId
protected abstract void onDuplicateId(String id)
this method is called when a duplicate id value is found.
-
onID
public void onID(org.relaxng.datatype.Datatype dt, StringToken token)
Description copied from interface:IDContextProvider2
this method is called when a type with ID semantics is matched. It is the callee's responsibility that stores ID and checks doubly defined ID, if it is necessary.- Specified by:
onID
in interfaceIDContextProvider2
-
-