public class Assertion extends SchemaStructure implements SchemaComponent, SerializableSchemaComponent
SchemaComponent.ValidationStatus
COMPONENT_FUNCTION_TYPE
Constructor and Description |
---|
Assertion() |
Assertion(EnterpriseConfiguration config,
XPathExpression condition,
XPathVariable valueVariable,
java.util.Map<StructuredQName,XPathVariable> params,
java.lang.String text)
Create an Assertion component
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other)
equals() is used when deciding whether two assertions are equal, as part of the type
subsumption algorithm.
|
Function |
getComponentAsFunction()
Get the schema component in the form of a function item.
|
XPathExpression |
getCondition()
Get the XPath expression representing the assertion.
|
java.lang.String |
getConditionText()
Get the original text of the condition.
|
java.lang.String |
getMessage()
Get the user-defined error message associated with the assertion
|
XPathStaticContext |
getStaticContext()
Get the static context for the expression
|
Sweep |
getSweep()
Get the sweep of the expression; if motionless or consuming, the validator
may attempt streamed evaluation.
|
XPathVariable |
getValueVariable()
Get the variable bound to the name $value
|
int |
hashCode()
Hashcode is used when deciding whether two assertions are equal, as part of the type
subsumption algorithm.
|
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component
|
static void |
setDocumentsAndCollections(Configuration config,
XPathDynamicContext context)
Set the dynamic XPath context to respond appropriately to requests for documents and collections
|
void |
setMessage(java.lang.String message)
Set the user-defined error message associated with the assertion
|
void |
setReturnsFailingNodes(boolean failingNodes)
Say that the expression should return the nodes that cause the expression to be
invalid, rather than returning a true/false result
|
void |
setStaticContext(XPathStaticContext staticContext)
Set the static context for the expression.
|
void |
setSweep(Sweep sweep)
Set the sweep of the expression; if motionless or consuming, the validator
may attempt streamed evaluation.
|
java.util.List<NodeInfo> |
testComplex(NodeInfo contextItem,
AtomicSequence value,
ValidationContext rules)
Evaluate a complex type assertion
|
boolean |
testSimple(AtomicSequence value,
ConversionRules rules)
Evaluate the assertion
|
elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getGeneratedId, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, hasSameLocation, isValidationNeeded, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setGeneratedId, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getRedefinitionLevel, getValidationStatus
public Assertion()
public Assertion(EnterpriseConfiguration config, XPathExpression condition, XPathVariable valueVariable, java.util.Map<StructuredQName,XPathVariable> params, java.lang.String text)
config
- the Saxon configurationcondition
- the compiled XPath expressionvalueVariable
- the variable to hold $value (may be null)params
- parameters declared using saxon:param and used in this expressiontext
- the original text of the XPath expressionpublic XPathExpression getCondition()
public XPathVariable getValueVariable()
public java.lang.String getConditionText()
public void setMessage(java.lang.String message)
message
- the message defined using the saxon:message attribute, if presentpublic java.lang.String getMessage()
public void setSweep(Sweep sweep)
sweep
- the sweep of the expression (indicating whether it is capable of streamed
evaluation)public Sweep getSweep()
public void setReturnsFailingNodes(boolean failingNodes)
failingNodes
- set to true if the result is a set of nodes that cause the assertion to failpublic void setStaticContext(XPathStaticContext staticContext)
staticContext
- the static contextpublic XPathStaticContext getStaticContext()
public boolean testSimple(AtomicSequence value, ConversionRules rules)
value
- the simple value to be tested, if any. If present, and if the expression
uses $value, this value will be bound to the variable $value for evaluating the assertion.rules
- used to provide context information
including the current error listener, URIResolver, and document pool, current date/time, etc.
To take advantage of validation parameters (saxon:param) this must be a ValidationContext; but
on other paths such as casting it is not possible to supply parameters, and the defaults are usedpublic java.util.List<NodeInfo> testComplex(NodeInfo contextItem, AtomicSequence value, ValidationContext rules)
contextItem
- the item to be used as the context item in evaluating the conditionvalue
- for a complex type with simple content, the typed value of the simple content,
as a sequence of atomic values.rules
- used to provide context information
including the current error listener, URIResolver, and document pool, current date/time, etc.
To take advantage of validation parameters (saxon:param) this must be a ValidationContext; but
on other paths such as casting it is not possible to supply parameters, and the defaults are usedpublic static void setDocumentsAndCollections(Configuration config, XPathDynamicContext context)
config
- the Saxon configurationcontext
- the dynamic context for evaluation of XPath expressions, which will be modified
by this request.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public void serialize(SchemaModelSerializer serializer) throws XPathException
serialize
in interface SerializableSchemaComponent
serializer
- the object responsible for performing the serializationXPathException
- if serialization failspublic Function getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.