org.enhydra.apache.xerces.validators.schema
Class TraverseSchema.Resolver

java.lang.Object
  |
  +--org.enhydra.apache.xerces.validators.schema.TraverseSchema.Resolver
All Implemented Interfaces:
EntityResolver
Enclosing class:
TraverseSchema

static class TraverseSchema.Resolver
extends Object
implements EntityResolver

Don't check the following code in because it creates a dependency on the serializer, preventing to package the parser without the serializer //Unit Test here public static void main(String args[] ) { if( args.length != 1 ) { System.out.println( "Error: Usage java TraverseSchema yourFile.xsd" ); System.exit(0); } DOMParser parser = new IgnoreWhitespaceParser(); parser.setEntityResolver( (fEntityResolver != null)? (fEntityResolver):(new Resolver()) ); parser.setErrorHandler( new ErrorHandler() ); try { parser.setFeature("http://xml.org/sax/features/validation", false); parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false); }catch( org.xml.sax.SAXNotRecognizedException e ) { e.printStackTrace(); }catch( org.xml.sax.SAXNotSupportedException e ) { e.printStackTrace(); } try { parser.parse( args[0]); }catch( IOException e ) { e.printStackTrace(); }catch( SAXException e ) { e.printStackTrace(); } Document document = parser.getDocument(); //Our Grammar OutputFormat format = new OutputFormat( document ); java.io.StringWriter outWriter = new java.io.StringWriter(); XMLSerializer serial = new XMLSerializer( outWriter,format); TraverseSchema tst = null; try { Element root = document.getDocumentElement();// This is what we pass to TraverserSchema //serial.serialize( root ); //System.out.println(outWriter.toString()); tst = new TraverseSchema( root, new StringPool(), new SchemaGrammar(), (GrammarResolver) new GrammarResolverImpl() ); } catch (Exception e) { e.printStackTrace(System.err); } parser.getDocument(); }


Constructor Summary
(package private) TraverseSchema.Resolver()
           
 
Method Summary
 InputSource resolveEntity(String publicId, String systemId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraverseSchema.Resolver

TraverseSchema.Resolver()
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws IOException
Specified by:
resolveEntity in interface EntityResolver
IOException


Copyright © 1999 The Apache Software Foundation. All Rights reserved.