Class XMLSchemaValidatorProp

  • All Implemented Interfaces:
    EventListener, IGProp<java.util.Map<java.lang.String,​java.lang.String>>, java.lang.Cloneable, org.w3c.dom.ls.LSResourceResolver

    public class XMLSchemaValidatorProp
    extends StringMapProp
    implements org.w3c.dom.ls.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 Detail

      • 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 Detail

      • getResourceSchema

        public static java.lang.String getResourceSchema​(java.lang.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<java.util.Map<java.lang.String,​java.lang.String>>
        Returns:
        true if the property should be set to private at creation, false for default.
      • getSchemaFactory

        public static javax.xml.validation.SchemaFactory getSchemaFactory()
                                                                   throws org.xml.sax.SAXNotRecognizedException,
                                                                          org.xml.sax.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:
        org.xml.sax.SAXNotSupportedException
        org.xml.sax.SAXNotRecognizedException
      • getDom3LoadSave

        public static org.w3c.dom.ls.DOMImplementationLS getDom3LoadSave()
                                                                  throws java.lang.ClassNotFoundException,
                                                                         java.lang.InstantiationException,
                                                                         java.lang.IllegalAccessException,
                                                                         java.lang.ClassCastException
        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:
        java.lang.ClassNotFoundException - If any specified class can not be found.
        java.lang.InstantiationException - If any specified class is an interface or abstract class.
        java.lang.IllegalAccessException - If the default constructor of a specified class is not accessible.
        java.lang.ClassCastException - If any specified class does not implement DOMImplementationSource.
      • setXMLSchemas

        public void setXMLSchemas​(java.util.Map<java.lang.String,​java.lang.String> schemaSources,
                                  javax.xml.validation.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:
        java.lang.NullPointerException - If the validator or the schemas sources are null.
        PropTypeException - If the property is read-only.
      • getValidator

        public javax.xml.validation.Validator getValidator()
                                                    throws org.xml.sax.SAXException
        Gets or creates the Schema validator from the Schema sources.
        Returns:
        The Schema validator.
        Throws:
        org.xml.sax.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 org.w3c.dom.ls.LSInput resolveResource​(java.lang.String type,
                                                      java.lang.String namespaceURI,
                                                      java.lang.String publicId,
                                                      java.lang.String systemId,
                                                      java.lang.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 org.w3c.dom.ls.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.