/** * Template method for creating the schema instance from the xml configuration. * <p> * Subclasses may with to override or exten this method. The default implementation * uses {@link Configuration#getSchemaFileURL()} and {@link Configuration#getSchemaLocationResolver()} * to parse the schema directly. * </p> * * @return The created schema. * * @throws Exception Any errors that occur while parsing the schema. */ protected XSDSchema createSchema() throws Exception { //add dependent location resolvers List resolvers = new ArrayList(); for ( Iterator d = configuration.allDependencies().iterator(); d.hasNext(); ) { Configuration dependency = (Configuration) d.next(); XSDSchemaLocationResolver resolver = dependency.getSchemaLocationResolver(); if ( resolver != null) { resolvers.add( resolver ); } } String location = configuration.getSchemaFileURL().toString(); if(logger.isLoggable(Level.FINE)) logger.fine("parsing schema " + configuration.getNamespaceURI() ); return Schemas.parse( location, null, resolvers ); } }
String schemaLocation = null; try{ URL location = new URL( conf.getSchemaFileURL() ); schemaLocation = location.toExternalForm(); }catch(MalformedURLException e){
URL location = new URL(conf.getSchemaFileURL()); schemaLocation = location.toExternalForm(); } catch (MalformedURLException e) {
URL location = new URL(conf.getSchemaFileURL()); schemaLocation = location.toExternalForm(); } catch (MalformedURLException e) {
config.getNamespaceURI() + " " + config.getSchemaFileURL());
/** * Parses the built document. * <p> * This method should be called after building the entire document. * * </p> * @throws Exception */ protected Object parse() throws Exception { Element root = document.getDocumentElement(); if (root == null) { throw new IllegalStateException("Document has no root element"); } Configuration config = createConfiguration(); registerNamespaces(root); //default root.setAttribute("xsi:schemaLocation", config.getNamespaceURI() + " " + config.getSchemaFileURL()); DOMParser parser = new DOMParser(config, document); return parser.parse(); }
/** * Parses the built document. * <p> * This method should be called after building the entire document. * * </p> * @throws Exception */ protected Object parse() throws Exception { Element root = document.getDocumentElement(); if ( root == null ) { throw new IllegalStateException( "Document has no root element" ); } Configuration config = createConfiguration(); registerNamespaces(root); //default root.setAttribute( "xsi:schemaLocation", config.getNamespaceURI() + " " + config.getSchemaFileURL() ); DOMParser parser = new DOMParser(config, document); return parser.parse(); }
schemaLocation.append(dependency.getSchemaFileURL()); handler.getConfiguration().getSchemaFileURL());
schemaLocation.append(dependency.getSchemaFileURL()); handler.getConfiguration().getSchemaFileURL());
schemaLocation.append( dependency.getSchemaFileURL() ); handler.getConfiguration().getSchemaFileURL() );
locations = new String[] { config.getNamespaceURI(), config.getSchemaFileURL() };
config.getNamespaceURI(), config.getSchemaFileURL() };
logger.finer( "No schemaLocation found, using '" + config.getNamespaceURI() + " " + config.getSchemaFileURL() ); locations = new String[] { config.getNamespaceURI(), config.getSchemaFileURL() };