Class XMLSchemaValidatorProp

All Implemented Interfaces:
EventListener, IGProp<Map<String,String>>, Cloneable, LSResourceResolver

public class XMLSchemaValidatorProp extends StringMapProp implements LSResourceResolver
XML Schema validator property class used to validate XML sources. This property is an extends the StringMapProp property class and stores the required schemas The XML Schemas are stored in the hash map with the namespaces URI as the key and the XSD source as values.
Author:
Christopher Mindus
  • Constructor Details

    • XMLSchemaValidatorProp

      protected XMLSchemaValidatorProp()
      Creates an XML Schema validator property with no name and an empty set if schema sources.
    • XMLSchemaValidatorProp

      public XMLSchemaValidatorProp(Atom propertyAtom)
      Creates an XML Schema validator property with specified name and an empty set if schema sources.
      Parameters:
      propertyAtom - the property atom.
  • Method Details

    • getResourceSchema

      public static String getResourceSchema(String namespaceURI)
      Gets the URL for a resource based namespace provided with IIZI, i.e. SOAP 1.1 and 1.2, WSDL 1.1 and XML security schemas.
      Parameters:
      namespaceURI - The namespace URI, if null then null is returned.
      Returns:
      The Schema contents, or null if not found.
    • isPropPrivateAtCreation

      protected boolean isPropPrivateAtCreation()
      Called upon creation of the property to check it's private state. This is used by properties that are not distributed to the remote party.

      The XML Schema validation property is private and is not transported to a remote party.

      Overrides:
      isPropPrivateAtCreation in class GProp<Map<String,String>>
      Returns:
      true if the property should be set to private at creation, false for default.
    • clone

      public XMLSchemaValidatorProp clone()
      Clones the XMLSchemaValidatorProp.
      Overrides:
      clone in class StringMapProp
    • getSchemaFactory

      public static SchemaFactory getSchemaFactory() throws SAXNotRecognizedException, SAXNotSupportedException
      Gets the schema factory. The factory is initialized for secure processing. In case of an exception, the error is logged as a severe event.
      Returns:
      The instance of the factory.
      Throws:
      SAXNotSupportedException
      SAXNotRecognizedException
    • getDom3LoadSave

      Gets the DOM Level 3 load/save implementation. In case of an exception, the error is logged as a severe event.
      Returns:
      The implementation instance.
      Throws:
      ClassNotFoundException - If any specified class can not be found.
      InstantiationException - If any specified class is an interface or abstract class.
      IllegalAccessException - If the default constructor of a specified class is not accessible.
      ClassCastException - If any specified class does not implement DOMImplementationSource.
    • setXMLSchemas

      public void setXMLSchemas(Map<String,String> schemaSources, Validator validator) throws PropTypeException
      Assigns the map of the schema sources along with an existing validator.
      Parameters:
      schemaSources - The map of namespaces as keys and their Schema sources as values.
      validator - The Schema validator for the schemas.
      Throws:
      NullPointerException - If the validator or the schemas sources are null.
      PropTypeException - If the property is read-only.
    • getValidator

      public Validator getValidator() throws SAXException
      Gets or creates the Schema validator from the Schema sources.
      Returns:
      The Schema validator.
      Throws:
      SAXException - If the validator could not be created.
    • resetValidator

      public void resetValidator()
      Resets the validator if new Schema sources have been added to the map using the StringMap functions. This will cause the Validator created in the call getValidator() to be created again from the new sources.
    • resolveResource

      public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)
      Allow the application to resolve external resources.

      The LSParser will call this method before opening any external resource, including the external DTD subset, external entities referenced within the DTD, and external entities referenced within the document element (however, the top-level document entity is not passed to this method). The application may then request that the LSParser resolve the external resource itself, that it use an alternative URI, or that it use an entirely different input source.

      Application writers can use this method to redirect external system identifiers to secure and/or local URI, to look up public identifiers in a catalog, or to read an entity from a database or other input source (including, for example, a dialog box).

      Specified by:
      resolveResource in interface LSResourceResolver
      Parameters:
      type - The type of the resource being resolved. For XML resources (i.e. entities), applications must use the value "http://www.w3.org/TR/REC-xml". For XML Schema, applications must use the value "http://www.w3.org/2001/XMLSchema". Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method.
      namespaceURI - The namespace of the resource being resolved.
      publicId - The public identifier of the external entity being referenced, or null for none.
      systemId - The system identifier, a URI reference of the external resource being referenced, or null for none.
      baseURI - The absolute base URI of the resource being parsed, or null if there is no base URI.
      Returns:
      A LSInput object describing the new input source, or null to request that the parser open a regular URI connection to the resource.