com.sun.msv.relaxns.verifier.AnyOtherElementVerifier Maven / Gradle / Ivy
/*
* @(#)$Id: AnyOtherElementVerifier.java,v 1.8 2003/06/09 20:37:38 kk122374 Exp $
*
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
*
*/
package com.sun.msv.relaxns.verifier;
import org.iso_relax.dispatcher.Dispatcher;
import org.iso_relax.dispatcher.ElementDecl;
import org.iso_relax.dispatcher.IslandSchema;
import org.iso_relax.dispatcher.IslandVerifier;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import com.sun.msv.relaxns.grammar.relax.AnyOtherElementExp;
/**
* IslandVerifier that validates <anyOtherElement /> of RELAX.
*
* @author Kohsuke KAWAGUCHI
*/
public class AnyOtherElementVerifier
extends DefaultHandler
implements IslandVerifier {
/** this Verifier validates these expressions.
*
* during validation, failed expression is removed.
*/
private final AnyOtherElementExp[] exps;
public AnyOtherElementVerifier( AnyOtherElementExp[] exps ) {
this.exps = exps;
}
protected Dispatcher dispatcher;
public void setDispatcher( Dispatcher disp ) {
this.dispatcher = disp;
}
public void startElement( String namespaceURI,
String localName, String qName, Attributes atts )
throws SAXException {
IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI);
if( is!=null ) {
// find an island that has to be validated.
// switch to the new IslandVerifier.
IslandVerifier iv = is.createNewVerifier( namespaceURI, is.getElementDecls() );
dispatcher.switchVerifier(iv);
iv.startElement(namespaceURI,localName,qName,atts);
return;
}
boolean atLeastOneIsValid = false;
for( int i=0; i © 2015 - 2025 Weber Informatics LLC | Privacy Policy