Package org.bremersee.xml
Interface SchemaBuilder
public interface SchemaBuilder
The schema builder wraps the standard
SchemaFactory
of Java into a builder. It also
offers the ability to load schema using Spring's ResourceLoader
.- Author:
- Christian Bremer
-
Method Summary
Modifier and TypeMethodDescriptionbuildSchema
(File file) Builds schema.default Schema
buildSchema
(String... locations) Retrieves the schema files of the specified locations and builds the schema.buildSchema
(URL url) Builds schema.default Schema
buildSchema
(Collection<? extends Source> sources) Builds schema.default Schema
buildSchema
(Source source) Builds schema.buildSchema
(Source[] sources) Builds schema.copy()
Copy schema builder.fetchSchemaSources
(String... locations) Retrieves the schema files of the specified locations.fetchSchemaSources
(Collection<String> locations) Retrieves the schema files of the specified locations.static SchemaBuilder
Creates a new schema builder.withClassLoader
(ClassLoader classLoader) Specifies the class loader to use.withErrorHandler
(ErrorHandler errorHandler) Specifies the error handler to use.withFactory
(String factoryClassName) Specifies the factory to use.withFeature
(String name, Boolean value) Adds a feature to the schema factory.withProperty
(String name, Object value) Adds a property to the schema factory.withResourceLoader
(org.springframework.core.io.ResourceLoader resourceLoader) Specifies the resource loader to use.withResourceResolver
(LSResourceResolver resourceResolver) Specifies the resource resolver to use.withSchemaLanguage
(String schemaLanguage) Specifies the schema language.
-
Method Details
-
newInstance
Creates a new schema builder.- Returns:
- the schema builder
-
copy
SchemaBuilder copy()Copy schema builder.- Returns:
- the schema builder
-
withSchemaLanguage
Specifies the schema language.Default is
javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI
("http://www.w3.org/2001/XMLSchema").- Parameters:
schemaLanguage
- specifies the schema language which the used schema factory will understand- Returns:
- the schema builder
- See Also:
-
withFactory
Specifies the factory to use.- Parameters:
factoryClassName
- the factory class name- Returns:
- the schema builder
- See Also:
-
withClassLoader
Specifies the class loader to use.- Parameters:
classLoader
- the class loader- Returns:
- the schema builder
- See Also:
-
withResourceLoader
Specifies the resource loader to use. The resource loader is used to retrieve the xsd files that are specified in the schema location (seefetchSchemaSources(String...)
).Default is
DefaultResourceLoader
.- Parameters:
resourceLoader
- the resource loader- Returns:
- the schema builder
-
withResourceResolver
Specifies the resource resolver to use.- Parameters:
resourceResolver
- the resource resolver- Returns:
- the schema builder
- See Also:
-
withErrorHandler
Specifies the error handler to use.- Parameters:
errorHandler
- the error handler- Returns:
- the schema builder
- See Also:
-
withFeature
Adds a feature to the schema factory.- Parameters:
name
- the namevalue
- the value- Returns:
- the schema builder
- See Also:
-
withProperty
Adds a property to the schema factory.- Parameters:
name
- the namevalue
- the value- Returns:
- the schema builder
- See Also:
-
fetchSchemaSources
Retrieves the schema files of the specified locations.The location can have any format that is supported by the
ResourceLoader
.- Parameters:
locations
- the locations- Returns:
- the list
- See Also:
-
fetchSchemaSources
Retrieves the schema files of the specified locations.The location can have any format that is supported by the
ResourceLoader
.- Parameters:
locations
- the locations- Returns:
- the schema files as source list
- See Also:
-
buildSchema
Retrieves the schema files of the specified locations and builds the schema.The location can have any format that is supported by the
ResourceLoader
.- Parameters:
locations
- the locations- Returns:
- the schema
-
buildSchema
Builds schema.- Parameters:
url
- the url- Returns:
- the schema
- See Also:
-
buildSchema
Builds schema.- Parameters:
file
- the file- Returns:
- the schema
- See Also:
-
buildSchema
Builds schema.- Parameters:
source
- the source- Returns:
- the schema
- See Also:
-
buildSchema
Builds schema.- Parameters:
sources
- the sources- Returns:
- the schema
- See Also:
-
buildSchema
Builds schema.- Parameters:
sources
- the sources- Returns:
- the schema
- See Also:
-