public boolean verify( XMLReader p, InputSource instance, boolean panicMode ) throws Exception { Dispatcher dispatcher = new DispatcherImpl(sp); dispatcher.attachXMLReader(p); ReportErrorHandler errorHandler = new ReportErrorHandler(); dispatcher.setErrorHandler( errorHandler ); // TODO: support the panicMode argument p.parse(instance); return !errorHandler.hadError; } }
public boolean isUnparsedEntity( String entityName ) { // create the set only when it is used. if( unparsedEntities==null ) { unparsedEntities = new java.util.HashSet(); int len = dispatcher.countUnparsedEntityDecls(); for( int i=0; i<len; i++ ) unparsedEntities.add( dispatcher.getUnparsedEntityDecl(i).name ); } return unparsedEntities.contains(entityName); }
public void fatalError( SAXParseException error ) throws SAXException { core.getErrorHandler().fatalError( error ); } public void error( SAXParseException error ) throws SAXException {
public void startElement(String s, String s1, String s2, Attributes attributes) throws SAXException { if(namespaceToIgnore.equals(s)) return; IslandSchema islandschema = dispatcher.getSchemaProvider().getSchemaByNamespace(s); if(islandschema == null) { return; } else { IslandVerifier islandverifier = islandschema.createNewVerifier(s, islandschema.getElementDecls()); dispatcher.switchVerifier(islandverifier); islandverifier.startElement(s, s1, s2, attributes); return; } }
throws SAXException { IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI); if( is!=null ) { dispatcher.switchVerifier(iv); iv.startElement(namespaceURI,localName,qName,atts); return; dispatcher.getErrorHandler().error( new SAXParseException( Localizer.localize( ERR_UNEXPECTED_NAMESPACE, new Object[]{namespaceURI} ),
/** * switch to another IslandVerifier to validate anyOtherElement. */ protected void switchToAnyOtherElement( AnyOtherElementExp[] exps, String namespaceUri, String localName, String qName, Attributes atts ) throws SAXException { // memorize AnyOtherElementExps to the map for( int i=0; i<exps.length; i++ ) rule2exp.put( exps[i], exps[i] ); IslandVerifier iv = new AnyOtherElementVerifier(exps); dispatcher.switchVerifier(iv); // remember tag names (these will be used in endChildIsland method) lastNamaespaceUri = namespaceUri; lastLocalName = localName; lastQName = qName; // simulate this startElement event iv.startElement( namespaceUri, localName, qName, atts ); }
IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceUri); dispatcher.switchVerifier( iv );
throws SAXException { IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI); if( is!=null ) { dispatcher.switchVerifier(iv); iv.startElement(namespaceURI,localName,qName,atts); return; dispatcher.getErrorHandler().error( new SAXParseException( Localizer.localize( ERR_UNEXPECTED_NAMESPACE, new Object[]{namespaceURI} ),
/** * switch to another IslandVerifier to validate anyOtherElement. */ protected void switchToAnyOtherElement( AnyOtherElementExp[] exps, String namespaceUri, String localName, String qName, Attributes atts ) throws SAXException { // memorize AnyOtherElementExps to the map for( int i=0; i<exps.length; i++ ) rule2exp.put( exps[i], exps[i] ); IslandVerifier iv = new AnyOtherElementVerifier(exps); dispatcher.switchVerifier(iv); // remember tag names (these will be used in endChildIsland method) lastNamaespaceUri = namespaceUri; lastLocalName = localName; lastQName = qName; // simulate this startElement event iv.startElement( namespaceUri, localName, qName, atts ); }
public void startElement( String namespaceURI, String localName, String qName, Attributes attributes ) throws SAXException { if( namespaceToIgnore.equals(namespaceURI) ) return; // this element is "validated". // try to locate a grammar of this namespace IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI); if( is==null ) {// no grammar is declared with this namespace URI. return; // continue ignoring. } // a schema is found: revert to normal mode and validate them. IslandVerifier iv = is.createNewVerifier( namespaceURI, is.getElementDecls() ); dispatcher.switchVerifier(iv); // simulate this startElement method. iv.startElement(namespaceURI,localName,qName,attributes); } }
throws SAXException { IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI); if( is!=null ) { dispatcher.switchVerifier(iv); iv.startElement(namespaceURI,localName,qName,atts); return; dispatcher.getErrorHandler().error( new SAXParseException( Localizer.localize( ERR_UNEXPECTED_NAMESPACE, new Object[]{namespaceURI} ),
public boolean verify( XMLReader p, InputSource instance, boolean panicMode ) throws Exception { Dispatcher dispatcher = new DispatcherImpl(sp); dispatcher.attachXMLReader(p); ReportErrorHandler errorHandler = new ReportErrorHandler(); dispatcher.setErrorHandler( errorHandler ); // TODO: support the panicMode argument p.parse(instance); return !errorHandler.hadError; } }
public boolean isUnparsedEntity( String entityName ) { // create the set only when it is used. if( unparsedEntities==null ) { unparsedEntities = new java.util.HashSet(); int len = dispatcher.countUnparsedEntityDecls(); for( int i=0; i<len; i++ ) unparsedEntities.add( dispatcher.getUnparsedEntityDecl(i).name ); } return unparsedEntities.contains(entityName); }
/** * switch to another IslandVerifier to validate anyOtherElement. */ protected void switchToAnyOtherElement( AnyOtherElementExp[] exps, String namespaceUri, String localName, String qName, Attributes atts ) throws SAXException { // memorize AnyOtherElementExps to the map for( int i=0; i<exps.length; i++ ) rule2exp.put( exps[i], exps[i] ); IslandVerifier iv = new AnyOtherElementVerifier(exps); dispatcher.switchVerifier(iv); // remember tag names (these will be used in endChildIsland method) lastNamaespaceUri = namespaceUri; lastLocalName = localName; lastQName = qName; // simulate this startElement event iv.startElement( namespaceUri, localName, qName, atts ); }
public void error( SAXParseException error ) throws SAXException { core.getErrorHandler().error( error ); } public void warning( SAXParseException error ) throws SAXException {
IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceUri); dispatcher.switchVerifier( iv );
throws SAXException { IslandSchema is = dispatcher.getSchemaProvider().getSchemaByNamespace(namespaceURI); if( is!=null ) { dispatcher.switchVerifier(iv); iv.startElement(namespaceURI,localName,qName,atts); return; dispatcher.getErrorHandler().error( new SAXParseException( Localizer.localize( ERR_UNEXPECTED_NAMESPACE, new Object[]{namespaceURI} ),
public boolean verify( XMLReader p, InputSource instance, boolean panicMode ) throws Exception { Dispatcher dispatcher = new DispatcherImpl(sp); dispatcher.attachXMLReader(p); ReportErrorHandler errorHandler = new ReportErrorHandler(); dispatcher.setErrorHandler( errorHandler ); // TODO: support the panicMode argument p.parse(instance); return !errorHandler.hadError; } }
public boolean isUnparsedEntity( String entityName ) { // create the set only when it is used. if( unparsedEntities==null ) { unparsedEntities = new java.util.HashSet(); int len = dispatcher.countUnparsedEntityDecls(); for( int i=0; i<len; i++ ) unparsedEntities.add( dispatcher.getUnparsedEntityDecl(i).name ); } return unparsedEntities.contains(entityName); }
/** * switch to another IslandVerifier to validate anyOtherElement. */ protected void switchToAnyOtherElement( AnyOtherElementExp[] exps, String namespaceUri, String localName, String qName, Attributes atts ) throws SAXException { // memorize AnyOtherElementExps to the map for( int i=0; i<exps.length; i++ ) { rule2exp.put( exps[i], exps[i] ); } IslandVerifier iv = new AnyOtherElementVerifier(exps); dispatcher.switchVerifier(iv); // remember tag names (these will be used in endChildIsland method) lastNamaespaceUri = namespaceUri; lastLocalName = localName; lastQName = qName; // simulate this startElement event iv.startElement( namespaceUri, localName, qName, atts ); }