Class PSSchema

java.lang.Object
com.helger.schematron.pure.model.PSSchema
All Implemented Interfaces:
IPSElement, IPSHasForeignAttributes, IPSHasForeignElements, IPSHasID, IPSHasIncludes, IPSHasLets, IPSHasRichGroup

@NotThreadSafe public class PSSchema extends Object implements IPSElement, IPSHasID, IPSHasForeignElements, IPSHasIncludes, IPSHasLets, IPSHasRichGroup
A single Schematron schema-element.
The top-level element of a Schematron schema.
The optional schemaVersion attribute gives the version of the schema. Its allowed values are not defined by this part of ISO/IEC 19757 and its use is implementation-dependent.
The optional queryBinding attribute provides the short name of the query language binding in use. If this attribute is specified, it is an error if it has a value that the current implementation does not support.
The defaultPhase attribute may be used to indicate the phase to use in the absence of explicit user-supplied information.
The title and p elements allow rich documentation.
The icon, see and fpi attributes allow rich interfaces and documentation.
Author:
Philip Helger
  • Constructor Details

    • PSSchema

      public PSSchema()
      Default constructor for a new schema that was not read from a file.
    • PSSchema

      public PSSchema(@Nullable com.helger.commons.io.resource.IReadableResource aResource)
      Constructor for reading a schema from a file.
      Parameters:
      aResource - The resource to be used. May be null indicating that this is a newly created schema.
  • Method Details

    • getResource

      @Nullable public com.helger.commons.io.resource.IReadableResource getResource()
      Returns:
      The resource from which the schema was read. May be null if the schema is newly created.
    • isValid

      public boolean isValid(@Nonnull IPSErrorHandler aErrorHandler)
      Description copied from interface: IPSElement
      Check if this element is specified completely. This method stops at the first encountered error.
      Specified by:
      isValid in interface IPSElement
      Parameters:
      aErrorHandler - The error handler where the error details are stored. May not be null.
      Returns:
      true if all mandatory fields are set and the element is valid, false otherwise.
    • validateCompletely

      public void validateCompletely(@Nonnull IPSErrorHandler aErrorHandler)
      Description copied from interface: IPSElement
      Check if this element is specified completely. This method performs all validations independent of the number of encountered error.
      Specified by:
      validateCompletely in interface IPSElement
      Parameters:
      aErrorHandler - The error handler where the error details are stored. May not be null.
    • isPreprocessed

      public boolean isPreprocessed()
      Check if this schema is already pre-processed or not. A schema is considered pre-processed if:
      • no includes are contained recursively and
      • no abstract patterns are contained and
      • no abstract rules are contained.
      Returns:
      true if it is pre-processed, false if not.
    • isMinimal

      public boolean isMinimal()
      Specified by:
      isMinimal in interface IPSElement
      Returns:
      true if this element conforms to the Schematron minimal syntax, false otherwise.
    • addForeignElement

      public void addForeignElement(@Nonnull com.helger.xml.microdom.IMicroElement aForeignElement)
      Specified by:
      addForeignElement in interface IPSHasForeignElements
    • hasForeignElements

      public boolean hasForeignElements()
      Specified by:
      hasForeignElements in interface IPSHasForeignElements
    • getAllForeignElements

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<com.helger.xml.microdom.IMicroElement> getAllForeignElements()
      Specified by:
      getAllForeignElements in interface IPSHasForeignElements
    • addForeignAttribute

      public void addForeignAttribute(@Nonnull String sAttrName, @Nonnull String sAttrValue)
      Specified by:
      addForeignAttribute in interface IPSHasForeignAttributes
    • hasForeignAttributes

      public boolean hasForeignAttributes()
      Specified by:
      hasForeignAttributes in interface IPSHasForeignAttributes
    • getAllForeignAttributes

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllForeignAttributes()
      Specified by:
      getAllForeignAttributes in interface IPSHasForeignAttributes
    • setID

      public void setID(@Nullable String sID)
      Description copied from interface: IPSHasID
      Set an ID for this object.
      Specified by:
      setID in interface IPSHasID
      Parameters:
      sID - The ID to be set. May be null.
    • getID

      @Nullable public String getID()
      Specified by:
      getID in interface IPSHasID
      Returns:
      The optional ID of this element. May be null.
    • setRich

      public void setRich(@Nullable PSRichGroup aRich)
      Description copied from interface: IPSHasRichGroup
      Overwrite any existing rich group.
      Specified by:
      setRich in interface IPSHasRichGroup
      Parameters:
      aRich - The new rich group to set. May be null.
    • getRich

      @Nullable public PSRichGroup getRich()
      Specified by:
      getRich in interface IPSHasRichGroup
      Returns:
      Get the existing rich group or null if none is present.
    • setQueryBinding

      public void setQueryBinding(@Nullable String sQueryBinding)
    • getQueryBinding

      @Nullable public String getQueryBinding()
    • setSchemaVersion

      public void setSchemaVersion(@Nullable String sSchemaVersion)
    • getSchemaVersion

      @Nullable public String getSchemaVersion()
    • setDefaultPhase

      public void setDefaultPhase(@Nullable String sDefaultPhase)
    • getDefaultPhase

      @Nullable public String getDefaultPhase()
    • setTitle

      public void setTitle(@Nullable PSTitle aTitle)
    • getTitle

      @Nullable public PSTitle getTitle()
    • hasTitle

      public boolean hasTitle()
    • addInclude

      public void addInclude(@Nonnull PSInclude aInclude)
      Description copied from interface: IPSHasIncludes
      Add an include to this object.
      Specified by:
      addInclude in interface IPSHasIncludes
      Parameters:
      aInclude - The include to be added. May not be null.
    • hasAnyInclude

      public boolean hasAnyInclude()
      Specified by:
      hasAnyInclude in interface IPSHasIncludes
      Returns:
      true if at least one include is present in this object.
    • getAllIncludes

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSInclude> getAllIncludes()
      Specified by:
      getAllIncludes in interface IPSHasIncludes
      Returns:
      A list of all contained includes. Never null.
    • addNS

      public void addNS(@Nonnull PSNS aNS)
    • hasAnyNS

      public boolean hasAnyNS()
    • getAllNSs

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSNS> getAllNSs()
    • getAsNamespaceContext

      @Nonnull @ReturnsMutableCopy public com.helger.xml.namespace.MapBasedNamespaceContext getAsNamespaceContext()
      Returns:
      All contained namespaces as a single namespace context
    • addStartP

      public void addStartP(@Nonnull PSP aP)
    • getAllStartPs

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSP> getAllStartPs()
    • addLet

      public void addLet(@Nonnull PSLet aLet)
      Description copied from interface: IPSHasLets
      Add a PSLet element.
      Specified by:
      addLet in interface IPSHasLets
      Parameters:
      aLet - The let element to be added. May not be null.
    • hasAnyLet

      public boolean hasAnyLet()
      Specified by:
      hasAnyLet in interface IPSHasLets
      Returns:
      true if this object has at least on contained PSLet object.
    • getAllLets

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSLet> getAllLets()
      Specified by:
      getAllLets in interface IPSHasLets
      Returns:
      A list of all contained PSLet elements. Never null.
    • getAllLetsAsMap

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllLetsAsMap()
      Specified by:
      getAllLetsAsMap in interface IPSHasLets
      Returns:
      The content of all PSLet elements as an ordered Map from name to value. The order must match the declaration order! Never null.
    • addPhase

      public void addPhase(@Nonnull PSPhase aPhase)
    • getAllPhases

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSPhase> getAllPhases()
    • getAllPhaseIDs

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<String> getAllPhaseIDs()
      Returns:
      A list with all phase IDs. Only phases having a valid ID are considered.
    • getPhaseOfID

      @Nullable public PSPhase getPhaseOfID(@Nullable String sID)
    • addPattern

      public void addPattern(@Nonnull PSPattern aPattern)
    • hasPatterns

      public boolean hasPatterns()
    • hasNoPatterns

      public boolean hasNoPatterns()
    • getAllPatterns

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSPattern> getAllPatterns()
    • getPatternCount

      @Nonnegative public int getPatternCount()
    • getPatternOfID

      @Nullable public PSPattern getPatternOfID(@Nullable String sID)
    • addEndP

      public void addEndP(@Nonnull PSP aP)
    • getAllEndPs

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSP> getAllEndPs()
    • setDiagnostics

      public void setDiagnostics(@Nullable PSDiagnostics aDiagnostics)
    • hasDiagnostics

      public boolean hasDiagnostics()
    • getDiagnostics

      @Nullable public PSDiagnostics getDiagnostics()
    • getAsMicroElement

      @Nonnull public com.helger.xml.microdom.IMicroElement getAsMicroElement()
      Specified by:
      getAsMicroElement in interface IPSElement
      Returns:
      The XML representation of this element. Never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object