com.saxonica.schema
Class Wildcard

java.lang.Object
  extended by com.saxonica.schema.SchemaStructure
      extended by com.saxonica.schema.Wildcard
All Implemented Interfaces:
SerializableSchemaComponent, Serializable, SourceLocator
Direct Known Subclasses:
AttributeWildcard, ElementWildcard

public abstract class Wildcard
extends SchemaStructure
implements SerializableSchemaComponent

A class that represents an XML Schema Wildcard. A wilcard is represented by the XML elements and and can be held in a complexType or in a Group ().

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.saxonica.schema.SerializableSchemaComponent
ALL_COMPOSITOR, ATOMIC_TYPE, ATTRIBUTE_DECL, ATTRIBUTE_GROUP, ATTRIBUTE_GROUP_REF, ATTRIBUTE_USE, ATTRIBUTE_WILDCARD, CHOICE_COMPOSITOR, COMPLEX_TYPE, ELEMENT_DECL, ELEMENT_PARTICLE, ELEMENT_WILDCARD, FACET, KEY, KEYREF, LIST_TYPE, MODEL_GROUP, MODEL_GROUP_REF, NOTATION, SEQUENCE_COMPOSITOR, UNION_TYPE, UNIQUE
 
Constructor Summary
Wildcard()
           
 
Method Summary
 void addNamespace(String namespace)
          Add a permitted namespace.
 boolean allowsAny()
          Determine whether this wildcard allows any namespace (##any)
 Iterator getAllowedNamespaces()
          Returns an enumeration that contains the permitted namespaces of this wildcard
 String getDisallowedNamespace()
          Get the disallowed namespace.
 String getProcessContents()
          Returns the processContents attribute of this wildcard
 boolean isIntensionalSubset(Wildcard sup)
          Determine whether this wildcard is an intensional subset of another wildcard.
static boolean isNotStronger(String str1, String str2)
          Test whether one processContents value is <= the strength of another, where skip < lax < strict
 boolean matches(String uri)
          Determine whether a particular namespace is allowed by this wildcard
 boolean overlaps(Wildcard other)
          Determine whether this wildcard overlaps another wildcard, that is, whether there is an element that could match either.
 void setDisallowedNamespace(String namespace)
          Set the disallowed namespace.
 void setNoNamespacesAllowed()
          Initialize the set of permitted namespaces to an empty set.
 void setProcessContents(String process)
          Sets the processContents attribute of the wildCard.
 String toString()
          Get a string representation of this wildcard, used for diagnostics
 boolean validate(SchemaCompiler compiler)
          Perform validation on this wildcard (this implementation of the method is a no-op)
 
Methods inherited from class com.saxonica.schema.SchemaStructure
getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setSystemId, setValidationStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.saxonica.schema.SerializableSchemaComponent
getComponentTypeCode, serialize
 

Constructor Detail

Wildcard

public Wildcard()
Method Detail

allowsAny

public final boolean allowsAny()
Determine whether this wildcard allows any namespace (##any)


setNoNamespacesAllowed

public void setNoNamespacesAllowed()
Initialize the set of permitted namespaces to an empty set. This is needed in case the namespace attribute is present but empty; it indicates that no namespaces are allowed.


addNamespace

public void addNamespace(String namespace)
Add a permitted namespace. This must be an actual namespace, not one of the special tokens such as ##other. Validation of the namespace is the responsibility of the caller.

Parameters:
namespace - the namespace to add

setDisallowedNamespace

public void setDisallowedNamespace(String namespace)
Set the disallowed namespace. This corresponds to the option ##other.


getDisallowedNamespace

public String getDisallowedNamespace()
Get the disallowed namespace. Returns null if there is no disallowed namespace.


matches

public boolean matches(String uri)
Determine whether a particular namespace is allowed by this wildcard

Parameters:
uri - the namespace to be tested. Supply "" for the null namespace.
Returns:
true if the wildcard allows this namespace, false if not.

getAllowedNamespaces

public Iterator getAllowedNamespaces()
Returns an enumeration that contains the permitted namespaces of this wildcard

Returns:
an enumeration that contains the permitted namespaces of this wildcard, or null if the wildcard uses the ##any or ##other options

getProcessContents

public String getProcessContents()
Returns the processContents attribute of this wildcard

Returns:
the processContents attribute of this wildcard, as a string ("strict", "lax", or "skip")

setProcessContents

public void setProcessContents(String process)
Sets the processContents attribute of the wildCard. For internal use only.

Parameters:
process - the processContents value to set (e.g. "strict", "lax"). Validation of the value is the responsibility of the caller.

validate

public boolean validate(SchemaCompiler compiler)
                 throws SchemaException
Perform validation on this wildcard (this implementation of the method is a no-op)

Throws:
SchemaException

toString

public String toString()
Get a string representation of this wildcard, used for diagnostics

Overrides:
toString in class Object

isIntensionalSubset

public boolean isIntensionalSubset(Wildcard sup)
Determine whether this wildcard is an intensional subset of another wildcard. See Schema Part 1 Schema Component Constraint: Wildcard Subset (section 3.10.6)


overlaps

public boolean overlaps(Wildcard other)
Determine whether this wildcard overlaps another wildcard, that is, whether there is an element that could match either.


isNotStronger

public static boolean isNotStronger(String str1,
                                    String str2)
Test whether one processContents value is <= the strength of another, where skip < lax < strict

Parameters:
str1 - the first processContents value, as a string
str2 - the second processContents value, as a string
Returns:
true if the pair is one of (strict, strict), (lax, lax), (skip, skip), (skip, strict), (lax, strict), (skip, lax)


Copyright (C) Michael H. Kay. All rights reserved.