Class AbstractSchematronResource

    • Constructor Detail

      • AbstractSchematronResource

        public AbstractSchematronResource​(@Nonnull
                                          com.helger.commons.io.resource.IReadableResource aResource)
        Constructor
        Parameters:
        aResource - The Schematron resource. May not be null.
    • Method Detail

      • getID

        @Nonnull
        public final String getID()
        Specified by:
        getID in interface com.helger.commons.id.IHasID<String>
      • getResource

        @Nonnull
        public final com.helger.commons.io.resource.IReadableResource getResource()
        Specified by:
        getResource in interface ISchematronResource
        Returns:
        The non-null resource from which to read the Schematron rules.
      • isUseCache

        public final boolean isUseCache()
        Specified by:
        isUseCache in interface ISchematronResource
        Returns:
        true to use caching, if applicable.
      • setUseCache

        public final void setUseCache​(boolean bUseCache)
        Description copied from interface: ISchematronResource
        Enable or disable caching.
        Specified by:
        setUseCache in interface ISchematronResource
        Parameters:
        bUseCache - true to use the cache, false to not use it.
      • isLenient

        public final boolean isLenient()
        Description copied from interface: ISchematronResource
        This is currently only supported for the "pure Schematron".
        Specified by:
        isLenient in interface ISchematronResource
        Returns:
        true if 'old' schematron NS is tolerated, false if not. Default is false.
      • setLenient

        public final void setLenient​(boolean bLenient)
        Description copied from interface: ISchematronResource
        This is currently only supported for the "pure Schematron". Allow use of 'old' schematron NS.
        Specified by:
        setLenient in interface ISchematronResource
        Parameters:
        bLenient - true if 'old' schematron NS is tolerated, false if not.
      • internalSetEntityResolver

        protected final void internalSetEntityResolver​(@Nullable
                                                       EntityResolver aEntityResolver)
        Set the XML entity resolver to be used when reading the Schematron or the XML to be validated. This can only be set before the Schematron is bound. If it is already bound an exception is thrown to indicate the unnecessity of the call.
        Parameters:
        aEntityResolver - The entity resolver to set. May be null.
        Since:
        4.2.3
      • internalCreateDOMReaderSettings

        @Nonnull
        @ReturnsMutableCopy
        protected com.helger.xml.serialize.read.DOMReaderSettings internalCreateDOMReaderSettings()
        Returns:
        The DOMReaderSettings to be used for reading the XML files to be validated. This includes the EntityResolver to be used.
        See Also:
        getEntityResolver()
      • getSchematronValidity

        @Nonnull
        public com.helger.commons.state.EValidity getSchematronValidity​(@Nonnull
                                                                        com.helger.commons.io.IHasInputStream aXMLResource)
                                                                 throws Exception
        Description copied from interface: ISchematronResource
        A method to check if the passed XML DOM node matches the Schematron rules or not. This is the quick check method, as it breaks upon the first failed assertion or the first successful report, if the implementation supports it (as e.g. the native pure Schematron version).
        Specified by:
        getSchematronValidity in interface ISchematronResource
        Parameters:
        aXMLResource - The source XML to read and validate against the Schematron. May not be null.
        Returns:
        EValidity.VALID if the document is valid, EValidity.INVALID if it is invalid.
        Throws:
        Exception - in case of a sever error validating the schema
      • getSchematronValidity

        @Nonnull
        public com.helger.commons.state.EValidity getSchematronValidity​(@Nonnull
                                                                        Source aXMLSource)
                                                                 throws Exception
        Description copied from interface: ISchematronResource
        A method to check if the passed XML DOM node matches the Schematron rules or not. This is the quick check method, as it breaks upon the first failed assertion or the first successful report, if the implementation supports it (as e.g. the native pure Schematron version).
        Specified by:
        getSchematronValidity in interface ISchematronResource
        Parameters:
        aXMLSource - The source XML to be validated against the Schematron. May not be null.
        Returns:
        EValidity.VALID if the document is valid, EValidity.INVALID if it is invalid.
        Throws:
        Exception - in case of a sever error validating the schema