Package com.saxonica.ee.schema
Class PreprocessFacet
- java.lang.Object
-
- com.saxonica.ee.schema.Facet
-
- com.saxonica.ee.schema.PreprocessFacet
-
public class PreprocessFacet extends Facet
Represents the preprocess facet on a schema-defined simple type. This is a pre-lexical facet defined as a Saxon extension to XML Schema 1.1: it allows an XPath expression to be used to convert the value as written (after whitespace normalization) to a different form, which is then validated using the constraining facets. For example the preprocessing action translate($value, ',', '.') allows the input value 3,14159 to be converted to 3.14159 which then validates as a double.
-
-
Constructor Summary
Constructors Constructor Description PreprocessFacet()
PreprocessFacet(Assertion action, Assertion reverseAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkFacetRestriction(UserSimpleType type, SimpleType base, SchemaCompiler compiler)
Check that this facet is legal when used on a type derived by restrictionAssertion
getAction()
Get the XPath expression representing the action performed by this facet, represented as an Assertion objectFunction
getFacetAsFunctionItem()
Get a function item that represents this Facet schema component.java.lang.String
getName()
Returns the name of this FacetAssertion
getReverseAction()
Get the XPath expression representing the reverse action performed by this facet, represented as an Assertion objectUnicodeString
getValue()
Returns the lexical representation of this facetboolean
isConstraining()
Ask whether this is a constraining facet (as distinct from a pre-lexical facet)UnicodeString
postprocess(UnicodeString input)
Apply the postprocessing defined by this facetUnicodeString
preprocess(UnicodeString input)
Apply the preprocessing defined by this facetvoid
serializeFacet(SchemaModelSerializer serializer)
Serialize this facet when externalizing the schema component modelvoid
setAction(Assertion action)
Set the XPath expression representing the action performed by this facet, represented as an Assertion objectvoid
setReverseAction(Assertion action)
Set the XPath expression representing the reverse action performed by this facet, represented as an Assertion objectboolean
testAtomicValue(AtomicValue value)
Test whether an atomic value conforms to this facet-
Methods inherited from class com.saxonica.ee.schema.Facet
getConstraintName, getMessage, getWhitespaceAction, isFacetName, isFixed, isNewlyIntroduced, makeFacet, setFixed, setMessage, testLength, testListValue, toLong
-
-
-
-
Method Detail
-
isConstraining
public boolean isConstraining()
Ask whether this is a constraining facet (as distinct from a pre-lexical facet)- Overrides:
isConstraining
in classFacet
- Returns:
- true if this is a constraining facet
-
getName
public java.lang.String getName()
Description copied from class:Facet
Returns the name of this Facet
-
getValue
public UnicodeString getValue()
Returns the lexical representation of this facet
-
getAction
public Assertion getAction()
Get the XPath expression representing the action performed by this facet, represented as an Assertion object
-
getReverseAction
public Assertion getReverseAction()
Get the XPath expression representing the reverse action performed by this facet, represented as an Assertion object
-
setAction
public void setAction(Assertion action)
Set the XPath expression representing the action performed by this facet, represented as an Assertion object
-
setReverseAction
public void setReverseAction(Assertion action)
Set the XPath expression representing the reverse action performed by this facet, represented as an Assertion object
-
checkFacetRestriction
public void checkFacetRestriction(UserSimpleType type, SimpleType base, SchemaCompiler compiler) throws SchemaException, ValidationException
Check that this facet is legal when used on a type derived by restriction- Overrides:
checkFacetRestriction
in classFacet
- Parameters:
base
- the type from which the restricted type is derivedcompiler
- the schema compilertype
- the type on which the facet is defined- Throws:
SchemaException
- if the facet is not legalValidationException
- if a value is found that does not conform to the facet
-
preprocess
public UnicodeString preprocess(UnicodeString input) throws ValidationException
Apply the preprocessing defined by this facet- Parameters:
input
- the lexical value, after whitespace normalization, to be converted- Returns:
- the value after preprocessing using the XPath expression defined in this facet
- Throws:
ValidationException
-
postprocess
public UnicodeString postprocess(UnicodeString input) throws ValidationException
Apply the postprocessing defined by this facet- Parameters:
input
- the lexical value to be converted- Returns:
- the value after postprocessing using the reverse XPath expression defined in this facet
- Throws:
ValidationException
-
testAtomicValue
public boolean testAtomicValue(AtomicValue value)
Test whether an atomic value conforms to this facet- Specified by:
testAtomicValue
in classFacet
- Parameters:
value
- the value to be tested- Returns:
- true if the value conforms; false if it doesn't conform, or if the test fails
-
serializeFacet
public void serializeFacet(SchemaModelSerializer serializer) throws XPathException
Description copied from class:Facet
Serialize this facet when externalizing the schema component model- Overrides:
serializeFacet
in classFacet
- Parameters:
serializer
- receives the content for serialization- Throws:
XPathException
- if an error occurs writing the value to the output
-
getFacetAsFunctionItem
public Function getFacetAsFunctionItem()
Description copied from class:Facet
Get a function item that represents this Facet schema component.- Specified by:
getFacetAsFunctionItem
in classFacet
-
-