Class SimpleXsdSchema

java.lang.Object
org.springframework.xml.xsd.SimpleXsdSchema
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, XsdSchema

public class SimpleXsdSchema extends Object implements XsdSchema, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
The default XsdSchema implementation.

Allows a XSD to be set by the setXsd(Resource), or directly in the constructor.

Since:
1.5.0
  • Constructor Details

    • SimpleXsdSchema

      public SimpleXsdSchema()
      Create a new instance of the SimpleXsdSchema class.

      A subsequent call to the setXsd(Resource) method is required.

    • SimpleXsdSchema

      public SimpleXsdSchema(org.springframework.core.io.Resource xsdResource)
      Create a new instance of the SimpleXsdSchema class with the specified resource.
      Parameters:
      xsdResource - the XSD resource; must not be null
      Throws:
      IllegalArgumentException - if the supplied xsdResource is null
    • SimpleXsdSchema

      public SimpleXsdSchema(org.springframework.core.io.Resource xsdResource, @Nullable String name)
      Create a new instance of the SimpleXsdSchema class with the specified resource and name.
      Parameters:
      xsdResource - the XSD resource; must not be null
      name - name of the schema
      Throws:
      IllegalArgumentException - if the supplied xsdResource is null
      Since:
      5.1.0
  • Method Details

    • getName

      public @Nullable String getName()
      Description copied from interface: XsdSchema
      Return the name of the schema, if known.
      Specified by:
      getName in interface XsdSchema
    • setName

      public void setName(String name)
      Set the name of this schem.
      Parameters:
      name - the name
      Since:
      5.1.0
    • setXsd

      public void setXsd(org.springframework.core.io.Resource xsdResource)
      Set the XSD resource to be exposed by calls to this instances' getSource() method.
      Parameters:
      xsdResource - the XSD resource
    • getTargetNamespace

      public String getTargetNamespace()
      Description copied from interface: XsdSchema
      Returns the target namespace of this schema.
      Specified by:
      getTargetNamespace in interface XsdSchema
      Returns:
      the target namespace
    • getSource

      public Source getSource()
      Description copied from interface: XsdSchema
      Returns the Source of the schema.
      Specified by:
      getSource in interface XsdSchema
      Returns:
      the source of this XSD schema
    • createValidator

      public XmlValidator createValidator()
      Description copied from interface: XsdSchema
      Creates a XmlValidator based on the schema.
      Specified by:
      createValidator in interface XsdSchema
      Returns:
      a validator for this schema
    • setBeanName

      public void setBeanName(String name)
      Specified by:
      setBeanName in interface org.springframework.beans.factory.BeanNameAware
    • afterPropertiesSet

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

      public String toString()
      Overrides:
      toString in class Object