public class Assertion extends SchemaStructure implements SchemaComponent, SerializableSchemaComponent
COMPONENT_FUNCTION_TYPE, FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING
Constructor and Description |
---|
Assertion(EnterpriseConfiguration config,
XPathExpression condition,
XPathVariable valueVariable,
Map<StructuredQName,XPathVariable> params,
String text)
Create an Assertion component
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(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.
|
String |
getConditionText()
Get the original text of the condition.
|
String |
getMessage()
Get the user-defined error message associated with the assertion
|
XPathStaticContext |
getStaticContext()
Get the static context for the expression
|
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(String message)
Set the user-defined error message associated with the assertion
|
void |
setStaticContext(XPathStaticContext staticContext)
Set the static context for the expression.
|
List<Item> |
test(Item contextItem,
Sequence value,
ConversionRules rules)
Evaluate the assertion
|
elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, makeXPathExpressionPropertyRecord, saveLocation, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getRedefinitionLevel, getValidationStatus
public Assertion(EnterpriseConfiguration config, XPathExpression condition, XPathVariable valueVariable, Map<StructuredQName,XPathVariable> params, 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 String getConditionText()
public void setMessage(String message)
message
- the message defined using the saxon:message attribute, if presentpublic String getMessage()
public void setStaticContext(XPathStaticContext staticContext)
staticContext
- the static contextpublic XPathStaticContext getStaticContext()
public List<Item> test(Item contextItem, Sequence value, ConversionRules rules)
contextItem
- the item to be used as the context item in evaluating the conditionvalue
- 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 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()
public boolean equals(Object other)
public void serialize(SchemaModelSerializer serializer) throws XPathException
serialize
in interface SerializableSchemaComponent
serializer
- the object responsible for performing the serializationMissingComponentException
- if the component cannot be serialized because it contains dangling referencesXPathException
- if serialization failspublic Function getComponentAsFunction()
SchemaComponent
getComponentAsFunction
in interface SchemaComponent
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.