Package com.sun.xml.xsom
Class SCD
java.lang.Object
com.sun.xml.xsom.SCD
- Direct Known Subclasses:
SCDImpl
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic SCD
create
(String path, NamespaceContext nsContext) Parses the string representation of SCD.final Collection<XSComponent>
select
(XSComponent contextNode) Evaluates the SCD against the given context node and returns the matched nodes.final Collection<XSComponent>
select
(XSSchemaSet contextNode) Evaluates the SCD against the whole schema and returns the matched nodes.final Collection<XSComponent>
select
(Collection<? extends XSComponent> contextNodes) Evaluates the SCD against the given set of context nodes and returns the matched nodes.abstract Iterator<XSComponent>
select
(Iterator<? extends XSComponent> contextNodes) Evaluates the SCD against the given set of context nodes and returns the matched nodes.final XSComponent
selectSingle
(XSComponent contextNode) Evaluates the SCD against the given context node and returns the matched node.final XSComponent
selectSingle
(XSSchemaSet contextNode) Evaluates the SCD against the whole schema set and returns the matched node.abstract String
toString()
Returns the textual SCD representation as given tocreate(String, NamespaceContext)
.
-
Constructor Details
-
SCD
public SCD()
-
-
Method Details
-
create
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(java.lang.String, javax.xml.namespace.NamespaceContext)
methods.- Parameters:
path
- the string representation of SCD, such as "/foo/bar".nsContext
- ItsNamespaceContext.getNamespaceURI(String)
is used to resolve prefixes in the SCD to the namespace URI.- Throws:
ParseException
-
select
Evaluates the SCD against the given context node and returns the matched nodes.- Returns:
- could be empty but never be null.
-
select
Evaluates the SCD against the whole schema and returns the matched nodes.This method is here because
XSSchemaSet
doesn't implementXSComponent
.- Returns:
- could be empty but never be null.
-
selectSingle
Evaluates the SCD against the given context node and returns the matched node.- Returns:
- null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
-
selectSingle
Evaluates the SCD against the whole schema set and returns the matched node.- Returns:
- null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
-
select
Evaluates the SCD against the given set of context nodes and returns the matched nodes.- Parameters:
contextNodes
-XSComponent
s that represent the context node against whichSCD
is evaluated.- Returns:
- could be empty but never be null.
-
select
Evaluates the SCD against the given set of context nodes and returns the matched nodes.- Parameters:
contextNodes
-XSComponent
s that represent the context node against whichSCD
is evaluated.- Returns:
- could be empty but never be null.
-
toString
Returns the textual SCD representation as given tocreate(String, NamespaceContext)
.
-