Class CommonsXsdSchemaCollection

java.lang.Object
org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware, XsdSchemaCollection

public class CommonsXsdSchemaCollection extends Object implements XsdSchemaCollection, org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware
Implementation of the XsdSchemaCollection that uses Apache WS-Commons XML Schema.

Setting the inline flag to true will result in all referenced schemas (included and imported) being merged into the referred schema. When including the schemas into a WSDL, this greatly simplifies the deployment of the schemas.

Since:
1.5.0
Author:
Arjen Poutsma
See Also:
  • Constructor Details

    • CommonsXsdSchemaCollection

      public CommonsXsdSchemaCollection()
      Constructs a new, empty instance of the CommonsXsdSchemaCollection.

      A subsequent call to the setXsds(Resource[]) is required.

    • CommonsXsdSchemaCollection

      public CommonsXsdSchemaCollection(org.springframework.core.io.Resource... resources)
      Constructs a new instance of the CommonsXsdSchemaCollection based on the given resources.
      Parameters:
      resources - the schema resources to load
  • Method Details

    • setXsds

      public void setXsds(org.springframework.core.io.Resource... xsdResources)
      Sets the schema resources to be loaded.
      Parameters:
      xsdResources - the schema resources to be loaded
    • setInline

      public void setInline(boolean inline)
      Defines whether included schemas should be inlined into the including schema.

      Defaults to false.

    • setUriResolver

      public void setUriResolver(org.apache.ws.commons.schema.resolver.URIResolver uriResolver)
      Sets the WS-Commons uri resolver to use when resolving (relative) schemas.

      Default is an internal subclass of DefaultURIResolver which correctly handles schemas on the classpath.

    • setResourceLoader

      public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
      Specified by:
      setResourceLoader in interface org.springframework.context.ResourceLoaderAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws IOException
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      IOException
    • getXsdSchemas

      public XsdSchema[] getXsdSchemas()
      Description copied from interface: XsdSchemaCollection
      Returns all schemas contained in this collection.
      Specified by:
      getXsdSchemas in interface XsdSchemaCollection
      Returns:
      the schemas contained in this collection
    • createValidator

      public XmlValidator createValidator()
      Description copied from interface: XsdSchemaCollection
      Creates a XmlValidator based on the schemas contained in this collection.
      Specified by:
      createValidator in interface XsdSchemaCollection
      Returns:
      a validator for this collection
    • toString

      public String toString()
      Overrides:
      toString in class Object