com.saxonica.schema
Class TypeAlternative

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

public class TypeAlternative
extends SchemaStructure

A TypeAlternative schema component (See XML Schema 1.1 Part 1 Working Draft)

See Also:
Serialized Form

Constructor Summary
TypeAlternative(EnterpriseConfiguration config, XPathExpression condition, String text)
          Create an TypeAlternative component
 
Method Summary
 boolean fixup(SchemaCompiler compiler)
          Fixup references from this schema component to others
 String getBaseURI()
          Get the base URI of the XPath expression
 XPathExpression getCondition()
          Get the XPath expression used in the test attribute of the alternative.
 String getConditionText()
          Get the original text of the condition.
 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
 SchemaType getSchemaType()
          Get the fixed-up schema type for this alternative
 TypeReference getTypeReference()
          Get the type reference for this alternative
 void serialize(SchemaModelSerializer serializer)
          Serialize the schema component
 void setBaseURI(String baseURI)
          Set the base URI of the XPath expression.
 void setDefaultElementNamespace(String namespace)
          Set the default namesapce for elements and types from the static context of the XPath expression
 void setNamespaceContext(NamespaceResolver resolver)
          Set the namespace context.
 void setTypeReference(TypeReference type)
          Set the type reference for this alternative
 
Methods inherited from class com.saxonica.schema.SchemaStructure
elaborate, 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

TypeAlternative

public TypeAlternative(EnterpriseConfiguration config,
                       XPathExpression condition,
                       String text)
Create an TypeAlternative component

Parameters:
config - the Saxon configuration
condition - the compiled XPath expression. May be null if no condition was specified (this is allowed on the last alternative)
text - the original text of the XPath expression. May be null if no condition was specified (this is allowed on the last alternative)
Method Detail

getCondition

public XPathExpression getCondition()
Get the XPath expression used in the test attribute of the alternative. Null represents an absent condition, equivalent to "true()".

Returns:
the XPath expression

getConditionText

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

Returns:
the original text of the XPath expression. May be null if no condition was specified

setDefaultElementNamespace

public void setDefaultElementNamespace(String namespace)
Set the default namesapce 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 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(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 String getBaseURI()
Get the base URI of the XPath expression

Returns:
the static base URI of the expression

setTypeReference

public void setTypeReference(TypeReference type)
Set the type reference for this alternative

Parameters:
type - a reference to the type selected by this alternative

getTypeReference

public TypeReference getTypeReference()
Get the type reference for this alternative

Returns:
the type reference

getSchemaType

public SchemaType getSchemaType()
Get the fixed-up schema type for this alternative

Returns:
the schema type

fixup

public boolean fixup(SchemaCompiler compiler)
              throws SchemaException
Fixup references from this schema component to others

Overrides:
fixup in class SchemaStructure
Parameters:
compiler - the SchemaCompiler, used primarily for reporting errors
Returns:
true if all references were fixed up successfully, false if dangling references were found
Throws:
SchemaException

serialize

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

Parameters:
serializer - the object responsible for serialization
Throws:
XPathException - if a serialization error occur


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