com.saxonica.schema
Class Assertion

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.Assertion
All Implemented Interfaces:
SerializableSchemaComponent, java.io.Serializable, javax.xml.transform.SourceLocator

public class Assertion
extends SchemaStructure
implements SerializableSchemaComponent

An Assertion schema component (See XML Schema 1.1 Part 1 Working Draft)

See Also:
Serialized Form

Constructor Summary
Assertion(SchemaAwareConfiguration config, XPathExpression condition, XPathVariable valueVariable, java.lang.String text)
          Create an Assertion component
 
Method Summary
 boolean equals(java.lang.Object other)
          equals() is used when deciding whether two assertions are equal, as part of the type subsumption algorithm.
 java.lang.String getBaseURI()
          Get the base URI of the XPath expression
 XPathExpression getCondition()
          Get the XPath expression representing the assertion.
 java.lang.String getConditionText()
          Get the original text of the condition.
 java.lang.String getDefaultElementNamespace()
          Get the default namesapce for elements and types from the static context of the XPath expression
 NamespaceResolver getNamespaceContext()
          Get the namespace context for evaluating the XPath 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
 void setBaseURI(java.lang.String baseURI)
          Set the base URI of the XPath expression.
 void setDefaultElementNamespace(java.lang.String namespace)
          Set the default namespace for elements and types from the static context of the XPath expression
 void setNamespaceContext(NamespaceResolver resolver)
          Set the namespace context.
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assertion

public Assertion(SchemaAwareConfiguration config,
                 XPathExpression condition,
                 XPathVariable valueVariable,
                 java.lang.String text)
Create an Assertion component

Parameters:
config - the Saxon configuration
condition - the compiled XPath expression
valueVariable - the variable to hold $value (may be null)
text - the original text of the XPath expression
Method Detail

getCondition

public XPathExpression getCondition()
Get the XPath expression representing the assertion. If xs:report is used, this will be the negation of the condition in the source schema.

Returns:
the XPath expression

getValueVariable

public XPathVariable getValueVariable()
Get the variable bound to the name $value

Returns:
the variable whose name is $value (may be null)

getConditionText

public java.lang.String getConditionText()
Get the original text of the condition.

Returns:
the original text of the XPath expression

setDefaultElementNamespace

public void setDefaultElementNamespace(java.lang.String namespace)
Set the default namespace for elements and types from the static context of the XPath expression

Parameters:
namespace - the default namespace for elements and types. The null namespace is represented as ""

getDefaultElementNamespace

public java.lang.String getDefaultElementNamespace()
Get the default namesapce for elements and types from the static context of the XPath expression

Returns:
the default namespace for elements and types. The null namespace is represented as ""

setNamespaceContext

public void setNamespaceContext(NamespaceResolver resolver)
Set the namespace context. This is needed to allow the assertion to be serialized, so that the namespace context can be replicated when it is reloaded.

Parameters:
resolver - defines the namespace context

getNamespaceContext

public NamespaceResolver getNamespaceContext()
Get the namespace context for evaluating the XPath expression

Returns:
a NamespaceResolver representing the namespace context of the expression

setBaseURI

public void setBaseURI(java.lang.String baseURI)
Set the base URI of the XPath expression. This is needed to allow the assertion to be serialized.

Parameters:
baseURI - the static base URI of the expression

getBaseURI

public java.lang.String getBaseURI()
Get the base URI of the XPath expression

Returns:
the static base URI of the expression

hashCode

public int hashCode()
Hashcode is used when deciding whether two assertions are equal, as part of the type subsumption algorithm. Assertions are equal if their XPath expressions are equal.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
equals() is used when deciding whether two assertions are equal, as part of the type subsumption algorithm. Assertions are equal if their XPath expressions are equal.

Overrides:
equals in class java.lang.Object

serialize

public void serialize(SchemaModelSerializer serializer)
               throws XPathException
Serialize the schema component

Specified by:
serialize in interface SerializableSchemaComponent
Throws:
XPathException


Copyright (c) Saxonica Limited. All rights reserved.