Package com.sun.msv.verifier.identity
Class IDConstraintChecker
java.lang.Object
com.sun.msv.verifier.AbstractVerifier
com.sun.msv.verifier.Verifier
com.sun.msv.verifier.identity.IDConstraintChecker
- All Implemented Interfaces:
IDContextProvider2
,IVerifier
,org.iso_relax.verifier.VerifierHandler
,org.relaxng.datatype.ValidationContext
,ContentHandler
,DTDHandler
Verifier with XML Schema-related enforcement.
This class can be used in the same way as Verifier
.
This class also checks XML Schema's identity constraint.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
a map fromIdentityConstraint
to aLightStack
ofSelectorMatcher
.static final String
static final String
static final String
static final String
static final String
protected final XMLSchemaGrammar
the grammar object against which we are validating.private final Map
a map fromSelectorMatcher
to set ofKeyValue
s.protected final Vector
active mathcers.private final Map
a map from keyrefSelectorMatcher
to key/uniqueSelectorMatcher
.Fields inherited from class com.sun.msv.verifier.Verifier
current, docDecl, ERR_DUPLICATE_ID, ERR_MISSING_ATTRIBUTE, ERR_UNCOMPLETED_CONTENT, ERR_UNEXPECTED_ATTRIBUTE, ERR_UNEXPECTED_ELEMENT, ERR_UNEXPECTED_STARTTAG, ERR_UNEXPECTED_TEXT, ERR_UNSOLD_IDREF, errorHandler, hadError, panicLevel
Fields inherited from class com.sun.msv.verifier.AbstractVerifier
dummyLocator, idrefs, ids, locator, namespaceSupport, performIDcheck
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected boolean
addKeyValue
(SelectorMatcher scope, KeyValue value) adds a new KeyValue to the value set.void
characters
(char[] buf, int start, int len) void
void
endElement
(String namespaceUri, String localName, String qName) protected org.relaxng.datatype.Datatype[]
protected SelectorMatcher
protected KeyValue[]
getKeyValues
(SelectorMatcher scope) gets the allKeyValue
s that were added within the specified scope.static String
localizeMessage
(String propertyName, Object arg) static String
localizeMessage
(String propertyName, Object[] args) protected void
onNextAcceptorReady
(StartTagInfo sti, Acceptor next) this method is called from the startElement method after the tag name is processed and the child acceptor is created.protected void
popActiveScope
(IdentityConstraint c, SelectorMatcher matcher) protected void
pushActiveScope
(IdentityConstraint c, SelectorMatcher matcher) protected void
protected void
reportError
(ErrorInfo ei, String propKey, Object[] args) reports an error.protected void
reportError
(Locator loc, ErrorInfo ei, String propKey, Object[] args) void
Methods inherited from class com.sun.msv.verifier.Verifier
getCurrentElementType, getErrorHandler, getLastCharacterType, ignorableWhitespace, init, isValid, onDuplicateId, onError, onError, setErrorHandler, setPanicMode, startElement, verifyText
Methods inherited from class com.sun.msv.verifier.AbstractVerifier
endPrefixMapping, getBaseUri, getLocator, isNotation, isUnparsedEntity, notationDecl, onID, processingInstruction, resolveNamespacePrefix, setDocumentLocator, skippedEntity, startPrefixMapping, 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.ContentHandler
endPrefixMapping, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping
Methods inherited from interface com.sun.msv.verifier.IVerifier
getLocator
-
Field Details
-
grammar
the grammar object against which we are validating. -
matchers
active mathcers. -
keyValues
a map fromSelectorMatcher
to set ofKeyValue
s. One SelectorMatcher correponds to one scope of the identity constraint. -
referenceScope
a map from keyrefSelectorMatcher
to key/uniqueSelectorMatcher
. Given a keyref scope, this map stores which key scope should it refer to. -
activeScopes
a map fromIdentityConstraint
to aLightStack
ofSelectorMatcher
. Each stack top keeps the currently active scope for the given IdentityConstraint. -
ERR_UNMATCHED_KEY_FIELD
- See Also:
-
ERR_NOT_UNIQUE
- See Also:
-
ERR_NOT_UNIQUE_DIAG
- See Also:
-
ERR_DOUBLE_MATCH
- See Also:
-
ERR_UNDEFINED_KEY
- See Also:
-
-
Constructor Details
-
IDConstraintChecker
-
-
Method Details
-
add
-
remove
-
getActiveScope
-
pushActiveScope
-
popActiveScope
-
addKeyValue
adds a new KeyValue to the value set.- Returns:
- true if this is a new value.
-
getKeyValues
gets the allKeyValue
s that were added within the specified scope. -
startDocument
- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classVerifier
- Throws:
SAXException
-
endDocument
- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classVerifier
- Throws:
SAXException
-
onNextAcceptorReady
Description copied from class:Verifier
this method is called from the startElement method after the tag name is processed and the child acceptor is created.This method is called before the attributes are consumed.
derived class can use this method to do something useful.
- Overrides:
onNextAcceptorReady
in classVerifier
- Throws:
SAXException
-
feedAttribute
protected org.relaxng.datatype.Datatype[] feedAttribute(Acceptor child, String uri, String localName, String qName, String value) throws SAXException - Overrides:
feedAttribute
in classVerifier
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classVerifier
- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classVerifier
- Throws:
SAXException
-
reportError
reports an error.- Throws:
SAXException
-
reportError
protected void reportError(Locator loc, ErrorInfo ei, String propKey, Object[] args) throws SAXException - Throws:
SAXException
-
localizeMessage
-
localizeMessage
-