Top Description Constructors Methods
com.sun.xml.xsom

public abstract Class SCD

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.xml.xsom.impl.scd.SCDImpl
Imports
com.sun.xml.xsom.impl.scd.Iterators, .ParseException, .SCDImpl, .SCDParser, .Step, .TokenMgrError, com.sun.xml.xsom.util.DeferedCollection, javax.xml.namespace.NamespaceContext, java.util.Collection, .Iterator, .List

Schema Component Designator (SCD).

SCD for schema is what XPath is for XML. SCD allows you to select a schema component(s) from a schema component(s).

See XML Schema: Component Designators. This implementation is based on 03/29/2005 working draft.

Author
Kohsuke Kawaguchi

Constructor Summary

AccessConstructor and Description
protected
SCD()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public static SCD
create(String
the string representation of SCD, such as "/foo/bar".
path
,
NamespaceContext
Its NamespaceContext#getNamespaceURI(String) is used to resolve prefixes in the SCD to the namespace URI.
nsContext
)

Parses the string representation of SCD.

public final Collection<XSComponent>

Returns:

could be empty but never be null.
select
(XSComponent contextNode)

Evaluates the SCD against the given context node and returns the matched nodes.

public final Collection<XSComponent>

Returns:

could be empty but never be null.
select
(XSSchemaSet contextNode)

Evaluates the SCD against the whole schema and returns the matched nodes.

public abstract Iterator<XSComponent>

Returns:

could be empty but never be null.
select
(Iterator<? extends XSComponent>
XSComponents that represent the context node against which is evaluated.
contextNodes
)

Evaluates the SCD against the given set of context nodes and returns the matched nodes.

public final Collection<XSComponent>

Returns:

could be empty but never be null.
select
(Collection<? extends XSComponent>
XSComponents that represent the context node against which is evaluated.
contextNodes
)

Evaluates the SCD against the given set of context nodes and returns the matched nodes.

public final XSComponent

Returns:

null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
selectSingle
(XSComponent contextNode)

Evaluates the SCD against the given context node and returns the matched node.

public final XSComponent

Returns:

null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
selectSingle
(XSSchemaSet contextNode)

Evaluates the SCD against the whole schema set and returns the matched node.

private static ParseException
public abstract String
toString()

Overrides java.lang.Object.toString.

Returns the textual SCD representation as given to SCD#create(String, NamespaceContext).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Constructor Detail

SCDback to summary
protected SCD()

Default constructor.

Method Detail

createback to summary
public static SCD create(String path, NamespaceContext nsContext) throws ParseException

Parses the string representation of SCD.

This method involves parsing the path expression and preparing the in-memory structure, so this is useful when you plan to use the same SCD against different context node multiple times.

If you want to evaluate SCD just once, use XSComponent#select methods.

Parameters
path:String

the string representation of SCD, such as "/foo/bar".

nsContext:NamespaceContext

Its NamespaceContext#getNamespaceURI(String) is used to resolve prefixes in the SCD to the namespace URI.

selectback to summary
public final Collection<XSComponent> select(XSComponent contextNode)

Evaluates the SCD against the given context node and returns the matched nodes.

Returns:Collection<XSComponent>

could be empty but never be null.

selectback to summary
public final Collection<XSComponent> select(XSSchemaSet contextNode)

Evaluates the SCD against the whole schema and returns the matched nodes.

This method is here because XSSchemaSet doesn't implement XSComponent.

Returns:Collection<XSComponent>

could be empty but never be null.

selectback to summary
public abstract Iterator<XSComponent> select(Iterator<? extends XSComponent> contextNodes)

Evaluates the SCD against the given set of context nodes and returns the matched nodes.

Parameters
contextNodes:Iterator<? extends XSComponent>

XSComponents that represent the context node against which is evaluated.

Returns:Iterator<XSComponent>

could be empty but never be null.

selectback to summary
public final Collection<XSComponent> select(Collection<? extends XSComponent> contextNodes)

Evaluates the SCD against the given set of context nodes and returns the matched nodes.

Parameters
contextNodes:Collection<? extends XSComponent>

XSComponents that represent the context node against which is evaluated.

Returns:Collection<XSComponent>

could be empty but never be null.

selectSingleback to summary
public final XSComponent selectSingle(XSComponent contextNode)

Evaluates the SCD against the given context node and returns the matched node.

Returns:XSComponent

null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.

selectSingleback to summary
public final XSComponent selectSingle(XSSchemaSet contextNode)

Evaluates the SCD against the whole schema set and returns the matched node.

Returns:XSComponent

null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.

setCauseback to summary
private static ParseException setCause(ParseException e, Throwable x)
toStringback to summary
public abstract String toString()

Overrides java.lang.Object.toString.

Returns the textual SCD representation as given to SCD#create(String, NamespaceContext).