Class PSPreprocessor
java.lang.Object
com.helger.schematron.pure.preprocess.PSPreprocessor
This is the pre-processor class for pure Schematron. It converts an existing
schema to the minimal syntax (by default) but allows for a certain degree of
customization by keeping certain elements in the resulting schema. The actual
query binding is used, so that report test expressions can be converted to
assertions, and to replace the content of <param> elements into actual
values.
- Author:
- Philip Helger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final booleanstatic final booleanstatic final booleanstatic final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PSPreprocessorcreatePreprocessorWithoutInformationLoss(IPSQueryBinding aQueryBinding) getAsMinimalSchema(PSSchema aSchema) Convert the passed schema to a minimal schema.getAsPreprocessedSchema(PSSchema aSchema) Convert the passed schema to a pre-processed schema.getForcedPreprocessedSchema(PSSchema aSchema) Convert the passed schema to a pre-processed schema independent if it is already minimal or not.booleanbooleanbooleanbooleanbooleansetKeepDiagnostics(boolean bKeepDiagnostics) Should <diagnostics>-elements be kept?setKeepEmptyPatterns(boolean bKeepEmptyPatterns) Should <pattern>-elements without a single rule be kept or deleted?setKeepEmptySchema(boolean bKeepEmptySchema) Should schema objects without a pattern be kept?setKeepReports(boolean bKeepReports) Should <report>-elements be kept or should they be converted to <assert>-elements?setKeepTitles(boolean bKeepTitles) Should <title>-elements be kept?toString()
-
Field Details
-
DEFAULT_KEEP_TITLES
public static final boolean DEFAULT_KEEP_TITLES- See Also:
-
DEFAULT_KEEP_DIAGNOSTICS
public static final boolean DEFAULT_KEEP_DIAGNOSTICS- See Also:
-
DEFAULT_KEEP_REPORTS
public static final boolean DEFAULT_KEEP_REPORTS- See Also:
-
DEFAULT_KEEP_EMPTY_PATTERNS
public static final boolean DEFAULT_KEEP_EMPTY_PATTERNS- See Also:
-
DEFAULT_KEEP_EMPTY_SCHEMA
public static final boolean DEFAULT_KEEP_EMPTY_SCHEMA- See Also:
-
-
Constructor Details
-
PSPreprocessor
-
-
Method Details
-
getQueryBinding
- Returns:
- The query binding to be used. Never
null!
-
isKeepTitles
public boolean isKeepTitles()- Returns:
trueif <title>-elements should be kept. Default is false.
-
setKeepTitles
Should <title>-elements be kept?- Parameters:
bKeepTitles-trueto keep titles,falseotherwise.- Returns:
- this for chaining
-
isKeepDiagnostics
public boolean isKeepDiagnostics()- Returns:
trueif <diagnostics>-elements should be kept. Default is false.
-
setKeepDiagnostics
Should <diagnostics>-elements be kept?- Parameters:
bKeepDiagnostics-trueto keep diagnostics,falseotherwise.- Returns:
- this for chaining
-
isKeepReports
public boolean isKeepReports()- Returns:
trueif <report>-elements should be kept,falseif they should be converted to <assert>-elements. Default is false.
-
setKeepReports
Should <report>-elements be kept or should they be converted to <assert>-elements?- Parameters:
bKeepReports-trueto keep <report>-elements,falseto change them to <assert>-elements- Returns:
- this for chaining
-
isKeepEmptyPatterns
public boolean isKeepEmptyPatterns()- Returns:
trueif <pattern>-elements without a rule should be kept. Default is true.
-
setKeepEmptyPatterns
Should <pattern>-elements without a single rule be kept or deleted?- Parameters:
bKeepEmptyPatterns-trueto keep <pattern>-elements without a rule,falseto delete them- Returns:
- this for chaining
-
isKeepEmptySchema
public boolean isKeepEmptySchema()- Returns:
trueif <schema>-elements without a pattern should be kept. Default is true.
-
setKeepEmptySchema
Should schema objects without a pattern be kept? It makes only sense to set it tofalseifsetKeepEmptyPatterns(boolean)is also set to false, because otherwise patterns without rules are kept.- Parameters:
bKeepEmptySchema-trueto keep them,falseto discard them.- Returns:
- this
-
getAsMinimalSchema
@Nullable public PSSchema getAsMinimalSchema(@Nonnull PSSchema aSchema) throws SchematronPreprocessException Convert the passed schema to a minimal schema.- Parameters:
aSchema- The schema to be made minimal. May not benull- Returns:
- The original schema object, if it is already minimal - a minimal
copy otherwise! May be
nullif the original schema is not yet minimal andisKeepEmptySchema()is set tofalse. - Throws:
SchematronPreprocessException- In case a preprocessing error occurs
-
getAsPreprocessedSchema
@Nullable public PSSchema getAsPreprocessedSchema(@Nonnull PSSchema aSchema) throws SchematronPreprocessException Convert the passed schema to a pre-processed schema.- Parameters:
aSchema- The schema to pre-process. May not benull- Returns:
- The original schema object, if it is already pre-processed - a
pre-processed copy otherwise! May be
nullif the original schema is not yet pre-processed andisKeepEmptySchema()is set tofalse. - Throws:
SchematronPreprocessException- In case a preprocessing error occurs
-
getForcedPreprocessedSchema
@Nullable public PSSchema getForcedPreprocessedSchema(@Nonnull PSSchema aSchema) throws SchematronPreprocessException Convert the passed schema to a pre-processed schema independent if it is already minimal or not.- Parameters:
aSchema- The schema to be made minimal. May not benull- Returns:
- A minimal copy of the schema. May be
nullif the original schema is not yet minimal andisKeepEmptySchema()is set tofalse. - Throws:
SchematronPreprocessException- In case a preprocessing error occurs
-
toString
-
createPreprocessorWithoutInformationLoss
@Nonnull public static PSPreprocessor createPreprocessorWithoutInformationLoss(@Nonnull IPSQueryBinding aQueryBinding)
-