/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location) throws IOException { return parse(location, Collections.EMPTY_LIST, Collections.EMPTY_LIST); }
/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location) throws IOException { return parse(location, (List)null, (List)null); }
/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location) throws IOException { return parse(location, (List) null, (List) null); }
/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * @param locators An array of schema locator objects to be used when * parsing imports/includes of the main schema. * @param resolvers An array of schema location resolvers used to override * schema locations encountered in an instance document or an imported * schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException { return parse(location, (locators != null) ? Arrays.asList(locators) : (List) null, (resolvers != null) ? Arrays.asList(resolvers) : (List) null); }
/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * @param locators An array of schema locator objects to be used when * parsing imports/includes of the main schema. * @param resolvers An array of schema location resolvers used to override * schema locations encountered in an instance document or an imported * schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException { return parse(location, (locators != null) ? Arrays.asList(locators) : Collections.EMPTY_LIST, (resolvers != null) ? Arrays.asList(resolvers) : Collections.EMPTY_LIST); }
/** * Parses a schema at the specified location. * * @param location A uri pointing to the location of the schema. * @param locators An array of schema locator objects to be used when * parsing imports/includes of the main schema. * @param resolvers An array of schema location resolvers used to override * schema locations encountered in an instance document or an imported * schema. * * @return The parsed schema, or null if the schema could not be parsed. * * @throws IOException In the event of a schema parsing error. */ public static final XSDSchema parse(String location, XSDSchemaLocator[] locators, XSDSchemaLocationResolver[] resolvers) throws IOException { return parse( location, locators != null ? Arrays.asList( locators ) : (List) null, resolvers != null ? Arrays.asList( resolvers ) : (List) null ); }
public XSDSchema locateSchema(XSDSchema schema, String namespaceURI, String rawSchemaLocationURI, String resolvedSchemaLocationURI) { if (GML.NAMESPACE.equals(namespaceURI)) { String location = getClass().getResource("gml.xsd").toString(); XSDSchemaLocationResolver[] locators = new XSDSchemaLocationResolver[] { new XLINKSchemaLocationResolver(), new SMIL20SchemaLocationResolver(), new GMLSchemaLocationResolver() }; try { return Schemas.parse(location, null, locators); } catch (IOException e) { //TODO: log this } } return null; } }
/** * 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 ); } }
/** * Builds the schema from the .xsd file specified by {@link #getSchemaLocation()} * <p> * This method may be extended, but should not be overridden. * </p> */ protected XSDSchema buildSchema() throws IOException { //grab all the dependencies and create schema locators from the build // schemas List locators = new ArrayList(); List resolvers = new ArrayList(); for (Iterator d = allDependencies().iterator(); d.hasNext();) { XSD dependency = (XSD) d.next(); SchemaLocator locator = dependency.createSchemaLocator(); if (locator != null) { locators.add(locator); } SchemaLocationResolver resolver = dependency.createSchemaLocationResolver(); if (resolver != null) { resolvers.add(resolver); } } SchemaLocationResolver resolver = createSchemaLocationResolver(); if (resolver != null) { resolvers.add(resolver); } //parse the location of the xsd with all the locators for dependent // schemas return Schemas.parse(getSchemaLocation(), locators, resolvers); }
/** * Builds the schema from the .xsd file specified by {@link #getSchemaLocation()} * <p> * This method may be extended, but should not be overridden. * </p> */ protected XSDSchema buildSchema() throws IOException { //grab all the dependencies and create schema locators from the build // schemas List locators = new ArrayList(); List resolvers = new ArrayList(); for (Iterator d = allDependencies().iterator(); d.hasNext();) { XSD dependency = (XSD) d.next(); SchemaLocator locator = dependency.createSchemaLocator(); if (locator != null) { locators.add(locator); } SchemaLocationResolver resolver = dependency.createSchemaLocationResolver(); if (resolver != null) { resolvers.add(resolver); } } SchemaLocationResolver resolver = createSchemaLocationResolver(); if (resolver != null) { resolvers.add(resolver); } //parse the location of the xsd with all the locators for dependent // schemas return Schemas.parse(getSchemaLocation(), locators, resolvers); }
schema = Schemas.parse(getSchemaLocation(), Collections.EMPTY_LIST, Collections.singletonList(new XSDSchemaLocationResolver() { public String resolveSchemaLocation(XSDSchema xsdSchema, String namespaceURI,
ftSchema = Schemas.parse(schemaFile.file().getAbsolutePath(), locators, resolvers); } catch (IOException e) { logger.log(
schemas[i / 2] = Schemas.parse(location, locators, resolvers); } catch (Exception e) { String msg = "Error parsing: " + location;
schemas[i / 2] = Schemas.parse(location, locators, resolvers); } catch (Exception e) { String msg = "Error parsing: " + location;
schemas[i / 2] = Schemas.parse(location, locators, resolvers); } catch (Exception e) { String msg = "Error parsing: " + location;
ftSchema = Schemas.parse(schemaFile.file().getAbsolutePath(), locators, null); } catch (IOException e) { LOGGER.log(