public GenericMsvValidator(XMLValidationSchema parent, ValidationContext ctxt, DocumentDeclaration vgm) { mParentSchema = parent; mContext = ctxt; mVGM = vgm; mCurrAcceptor = mVGM.createAcceptor(); mAttributeProxy = new AttributeProxy(ctxt); }
public int validateElementAndAttributes() throws XMLStreamException { // Not handling any attributes mCurrAttrLocalName = mCurrAttrPrefix = ""; if (mCurrAcceptor != null) { /* start tag info is still intact here (only attributes sent * since child acceptor was created) */ if (!mCurrAcceptor.onEndAttributes(mStartTag, mErrorRef) || mErrorRef.str != null) { reportError(mErrorRef); } int stringChecks = mCurrAcceptor.getStringCareLevel(); switch (stringChecks) { case Acceptor.STRING_PROHIBITED: // only WS return XMLValidator.CONTENT_ALLOW_WS; case Acceptor.STRING_IGNORE: // anything (mixed content models) return XMLValidator.CONTENT_ALLOW_ANY_TEXT; case Acceptor.STRING_STRICT: // validatable (data-oriented) return XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT; default: throw new IllegalArgumentException("Internal error: unexpected string care level value return by MSV: "+stringChecks); } } // If no acceptor, we are recovering, no need or use to validate text return CONTENT_ALLOW_ANY_TEXT; }
void doValidateText(TextAccumulator textAcc) throws XMLStreamException { if (mCurrAcceptor != null) { String str = textAcc.getAndClear(); DatatypeRef typeRef = null; if (!mCurrAcceptor.onText2(str, this, mErrorRef, typeRef) || mErrorRef.str != null) { reportError(mErrorRef); } } }
if (!acc.isAcceptState(mErrorRef) || mErrorRef.str != null) { reportError(mErrorRef); if (!mCurrAcceptor.stepForward(acc, mErrorRef) || mErrorRef.str != null) { reportError(mErrorRef); int stringChecks = mCurrAcceptor.getStringCareLevel(); switch (stringChecks) { case Acceptor.STRING_PROHIBITED: // only WS
public void startDocument() throws SAXException { // reset everything. // since Verifier maybe reused, initialization is better done here // rather than constructor. init(); // if Verifier is used without "divide&validate", // this method is called and the initial acceptor // is set by this method. // When Verifier is used in IslandVerifierImpl, // then initial acceptor is set at the constructor // and this method is not called. current = docDecl.createAcceptor(); }
public String validateAttribute(String localName, String uri, String prefix, String value) throws XMLStreamException { mCurrAttrLocalName = localName; mCurrAttrPrefix = prefix; if (mCurrAcceptor != null) { String qname = localName; // for now, let's assume we don't need prefixed version DatatypeRef typeRef = null; // for now, let's not care /* 31-Mar-2006, TSa: MSV seems to require empty String for empty/no * namespace, not null. */ if (uri == null) { uri = ""; } if (!mCurrAcceptor.onAttribute2(uri, localName, qname, value, this, mErrorRef, typeRef) || mErrorRef.str != null) { reportError(mErrorRef); } if (mProblem != null) { // pending problems (to throw exception on)? XMLValidationProblem p = mProblem; mProblem = null; mContext.reportProblem(p); } } /* No normalization done by RelaxNG, is there? (at least nothing * visible to callers that is) */ return null; }
mStartTag.reinit(uri, localName, qname, mAttributeProxy, this); mCurrAcceptor = mCurrAcceptor.createChildAcceptor(mStartTag, mErrorRef);
public VerifierFilter( DocumentDeclaration documentDecl, ErrorHandler errorHandler ) { this( new Verifier(documentDecl,errorHandler) ); }
public Object getCurrentElementType() { return verifier.getCurrentElementType(); } public Datatype[] getLastCharacterType() {
public Datatype[] getLastCharacterType() { return verifier.getLastCharacterType(); } public final Locator getLocator() {
public boolean isValid() { return verifier.isValid(); } public Object getCurrentElementType() {
public final Locator getLocator() { return verifier.getLocator(); } public final ErrorHandler getErrorHandler() {
public final ErrorHandler getErrorHandler() { return verifier.getErrorHandler(); } public final void setErrorHandler( ErrorHandler handler ) {
public final void setPanicMode( boolean usePanicMode ) { verifier.setPanicMode(usePanicMode); }
public void startDocument() throws SAXException { // reset everything. // since Verifier maybe reused, initialization is better done here // rather than constructor. init(); // if Verifier is used without "divide&validate", // this method is called and the initial acceptor // is set by this method. // When Verifier is used in IslandVerifierImpl, // then initial acceptor is set at the constructor // and this method is not called. current = docDecl.createAcceptor(); }
public Object getCurrentElementType() { return verifier.getCurrentElementType(); } public Datatype[] getLastCharacterType() {
public Datatype[] getLastCharacterType() { return verifier.getLastCharacterType(); } public final Locator getLocator() {
public void startDocument() throws SAXException { // reset everything. // since Verifier maybe reused, initialization is better done here // rather than constructor. init(); // if Verifier is used without "divide&validate", // this method is called and the initial acceptor // is set by this method. // When Verifier is used in IslandVerifierImpl, // then initial acceptor is set at the constructor // and this method is not called. current = docDecl.createAcceptor(); }
public Object getCurrentElementType() { return verifier.getCurrentElementType(); } public Datatype[] getLastCharacterType() {
public void startDocument() throws SAXException { // reset everything. // since Verifier maybe reused, initialization is better done here // rather than constructor. init(); // if Verifier is used without "divide&validate", // this method is called and the initial acceptor // is set by this method. // When Verifier is used in IslandVerifierImpl, // then initial acceptor is set at the constructor // and this method is not called. current = docDecl.createAcceptor(); }