com.saxonica.schema
Class IdentityField

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.IdentityField
All Implemented Interfaces:
Serializable, SourceLocator

public class IdentityField
extends SchemaStructure

The field selector for an IdentityConstraint

See Also:
Serialized Form

Constructor Summary
IdentityField(String xpath)
          Creates a new IdentityField.
 
Method Summary
 int getCardinality(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)
          Get the static cardinality of the expression, that is the number of nodes the field xpath will select for each node selected by the selector xpath.
 NamespaceResolver getNamespaceContext()
          Get the namespace context for evaluating the XPath expression
 Pattern getSelection()
          Get the compiled XPath expression
 String getXPath()
          Returns the XPath of this IdentityField.
 String getXPathDefaultNamespace()
          Get the XPath default namespace
 void setEquivalentExpression(Expression exp)
          Sets the compiled XPath expression for this Field.
 void setNamespaceContext(NamespaceResolver resolver)
          Set the namespace context.
 void setSelection(Pattern selection)
          Set the compiled XPath expression
 void setXPath(String xpath)
          Sets the XPath expression for this Field.
 void setXPathDefaultNamespace(String uri)
          Set the XPath default namespace
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, fixup, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityField

public IdentityField(String xpath)
Creates a new IdentityField.

Parameters:
xpath - the xpath for the IdentityField. Must not be null.
Method Detail

getXPath

public String getXPath()
Returns the XPath of this IdentityField. This value will never be null.

Returns:
the XPath of this IdentityField.

getSelection

public Pattern getSelection()
Get the compiled XPath expression

Returns:
the compiled XPath expression, as a Pattern object

setXPath

public void setXPath(String xpath)
Sets the XPath expression for this Field.

Parameters:
xpath - the XPath expression for this IdentityField. Must not be null.

setEquivalentExpression

public void setEquivalentExpression(Expression exp)
Sets the compiled XPath expression for this Field.

Parameters:
exp - the compiled XPath expression for this IdentityField. Must not be null.

setSelection

public void setSelection(Pattern selection)
Set the compiled XPath expression

Parameters:
selection - the compiled selection expression, expressed as a Pattern (because it uses a sufficiently small subset of XPath)

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 - the namespace resolved to be used for resolving prefixes within the XPath expression to URIs

getNamespaceContext

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

Returns:
a NamespaceResolver that encapusulates the available prefix-uri bindings

setXPathDefaultNamespace

public void setXPathDefaultNamespace(String uri)
Set the XPath default namespace

Parameters:
uri - the XPath default namespace

getXPathDefaultNamespace

public String getXPathDefaultNamespace()
Get the XPath default namespace

Returns:
the XPath default namespace

getCardinality

public int getCardinality(ExpressionVisitor visitor,
                          ExpressionVisitor.ContextItemType contextItemType)
                   throws XPathException
Get the static cardinality of the expression, that is the number of nodes the field xpath will select for each node selected by the selector xpath.

Parameters:
visitor - the expression visitor
contextItemType - the type of the context item, and information about whether a context item will always be provided or not
Returns:
the static cardinality
Throws:
XPathException - if an error is found during the evaluation


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.