public class IDConstraintChecker extends Verifier
This class can be used in the same way as Verifier
.
This class also checks XML Schema's identity constraint.
Modifier and Type | Field and Description |
---|---|
private java.util.Map |
activeScopes
a map from
IdentityConstraint to a LightStack of
SelectorMatcher . |
static java.lang.String |
ERR_DOUBLE_MATCH |
static java.lang.String |
ERR_NOT_UNIQUE |
static java.lang.String |
ERR_NOT_UNIQUE_DIAG |
static java.lang.String |
ERR_UNDEFINED_KEY |
static java.lang.String |
ERR_UNMATCHED_KEY_FIELD |
protected XMLSchemaGrammar |
grammar
the grammar object against which we are validating.
|
private java.util.Map |
keyValues
a map from
SelectorMatcher to set of KeyValue s. |
protected java.util.Vector |
matchers
active mathcers.
|
private java.util.Map |
referenceScope
a map from keyref
SelectorMatcher to key/unique
SelectorMatcher . |
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
dummyLocator, idrefs, ids, locator, namespaceSupport, performIDcheck
Constructor and Description |
---|
IDConstraintChecker(XMLSchemaGrammar grammar,
org.xml.sax.ErrorHandler errorHandler) |
Modifier and Type | Method and Description |
---|---|
protected void |
add(Matcher matcher) |
protected boolean |
addKeyValue(SelectorMatcher scope,
KeyValue value)
adds a new KeyValue to the value set.
|
void |
characters(char[] buf,
int start,
int len) |
void |
endDocument() |
void |
endElement(java.lang.String namespaceUri,
java.lang.String localName,
java.lang.String qName) |
protected org.relaxng.datatype.Datatype[] |
feedAttribute(Acceptor child,
java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
java.lang.String value) |
protected SelectorMatcher |
getActiveScope(IdentityConstraint c) |
protected KeyValue[] |
getKeyValues(SelectorMatcher scope)
gets the all
KeyValue s that were added within the specified scope. |
static java.lang.String |
localizeMessage(java.lang.String propertyName,
java.lang.Object arg) |
static java.lang.String |
localizeMessage(java.lang.String propertyName,
java.lang.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 |
remove(Matcher matcher) |
protected void |
reportError(ErrorInfo ei,
java.lang.String propKey,
java.lang.Object[] args)
reports an error.
|
protected void |
reportError(org.xml.sax.Locator loc,
ErrorInfo ei,
java.lang.String propKey,
java.lang.Object[] args) |
void |
startDocument() |
getCurrentElementType, getErrorHandler, getLastCharacterType, ignorableWhitespace, init, isValid, onDuplicateId, onError, onError, setErrorHandler, setPanicMode, startElement, verifyText
endPrefixMapping, getBaseUri, getLocator, isNotation, isUnparsedEntity, notationDecl, onID, processingInstruction, resolveNamespacePrefix, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLocator
protected final XMLSchemaGrammar grammar
protected final java.util.Vector matchers
private final java.util.Map keyValues
SelectorMatcher
to set of KeyValue
s.
One SelectorMatcher correponds to one scope of the identity constraint.private final java.util.Map referenceScope
SelectorMatcher
to key/unique
SelectorMatcher
.
Given a keyref scope, this map stores which key scope should it refer to.private final java.util.Map activeScopes
IdentityConstraint
to a LightStack
of
SelectorMatcher
.
Each stack top keeps the currently active scope for the given IdentityConstraint.public static final java.lang.String ERR_UNMATCHED_KEY_FIELD
public static final java.lang.String ERR_NOT_UNIQUE
public static final java.lang.String ERR_NOT_UNIQUE_DIAG
public static final java.lang.String ERR_DOUBLE_MATCH
public static final java.lang.String ERR_UNDEFINED_KEY
public IDConstraintChecker(XMLSchemaGrammar grammar, org.xml.sax.ErrorHandler errorHandler)
protected void add(Matcher matcher)
protected void remove(Matcher matcher)
protected SelectorMatcher getActiveScope(IdentityConstraint c)
protected void pushActiveScope(IdentityConstraint c, SelectorMatcher matcher)
protected void popActiveScope(IdentityConstraint c, SelectorMatcher matcher)
protected boolean addKeyValue(SelectorMatcher scope, KeyValue value)
protected KeyValue[] getKeyValues(SelectorMatcher scope)
KeyValue
s that were added within the specified scope.public void startDocument() throws org.xml.sax.SAXException
startDocument
in interface org.xml.sax.ContentHandler
startDocument
in class Verifier
org.xml.sax.SAXException
public void endDocument() throws org.xml.sax.SAXException
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class Verifier
org.xml.sax.SAXException
protected void onNextAcceptorReady(StartTagInfo sti, Acceptor next) throws org.xml.sax.SAXException
Verifier
This method is called before the attributes are consumed.
derived class can use this method to do something useful.
onNextAcceptorReady
in class Verifier
org.xml.sax.SAXException
protected org.relaxng.datatype.Datatype[] feedAttribute(Acceptor child, java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String value) throws org.xml.sax.SAXException
feedAttribute
in class Verifier
org.xml.sax.SAXException
public void characters(char[] buf, int start, int len) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class Verifier
org.xml.sax.SAXException
public void endElement(java.lang.String namespaceUri, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class Verifier
org.xml.sax.SAXException
protected void reportError(ErrorInfo ei, java.lang.String propKey, java.lang.Object[] args) throws org.xml.sax.SAXException
org.xml.sax.SAXException
protected void reportError(org.xml.sax.Locator loc, ErrorInfo ei, java.lang.String propKey, java.lang.Object[] args) throws org.xml.sax.SAXException
org.xml.sax.SAXException
public static java.lang.String localizeMessage(java.lang.String propertyName, java.lang.Object arg)
public static java.lang.String localizeMessage(java.lang.String propertyName, java.lang.Object[] args)