Top Description Methods
com.sun.xml.xsom

public Interface XSComponent

Known Direct Subinterfaces
com.sun.xml.xsom.XSContentType, com.sun.xml.xsom.XSDeclaration, com.sun.xml.xsom.XSIdentityConstraint, com.sun.xml.xsom.XSModelGroup, com.sun.xml.xsom.XSSchema, com.sun.xml.xsom.XSTerm, com.sun.xml.xsom.XSWildcard, com.sun.xml.xsom.XSXPath, com.sun.xml.xsom.XSFacet, com.sun.xml.xsom.XSAttributeUse
Known Direct Implementers
com.sun.xml.xsom.impl.ComponentImpl
Imports
com.sun.xml.xsom.parser.SchemaDocument, com.sun.xml.xsom.visitor.XSFunction, .XSVisitor, org.xml.sax.Locator, javax.xml.namespace.NamespaceContext, java.util.List, .Collection

Base interface for all the schema components.
Author
Kohsuke Kawaguchi ([email protected])

Method Summary

Modifier and TypeMethod and Description
public <T> T
apply(XSFunction<T> function)

Accepts a functor.

public XSAnnotation
getAnnotation()

Gets the annotation associated to this component, if any.

public XSAnnotation

Returns:

null if createIfNotExist==false and annotation didn't exist. Otherwise non-null.
getAnnotation
(boolean
true to create a new XSAnnotation if it doesn't exist already. false to make this method behavel like getAnnotation().
createIfNotExist
)

Works like getAnnotation(), but allow a new empty XSAnnotation to be created if not exist.

public String
getForeignAttribute(String nsUri, String localName)

Gets the foreign attribute of the given name, or null if not found.

public List<? extends ForeignAttributes>

Returns:

can be an empty list but never be null.
getForeignAttributes
()

Gets the foreign attributes on this schema component.

public Locator
getLocator()

Gets the locator that indicates the source location where this component is created from, or null if no information is available.

public XSSchema
getOwnerSchema()

Gets a reference to the XSSchema object to which this component belongs.

public XSSchemaSet
getRoot()

Gets the root schema set that includes this component.

public SchemaDocument

Returns:

null for components that are built-in to XML Schema, such as anyType, or "empty" XSContentType. This method also returns null for XSSchema. For all other user-defined components this method returns non-null, even if they are local.
getSourceDocument
()

Gets the SchemaDocument that indicates which document this component was defined in.

public Collection<XSComponent>

Returns:

Can be empty but never null.
select
(String
Schema component designator. See SCD for more details.
scd
,
NamespaceContext
The namespace context in which SCD is evaluated. Cannot be null.
nsContext
)

Evaluates a schema component designator against this schema component and returns the resulting schema components.

public 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
(String
Schema component designator. See SCD for more details.
scd
,
NamespaceContext
The namespace context in which SCD is evaluated. Cannot be null.
nsContext
)

Evaluates a schema component designator against this schema component and returns the first resulting schema component.

public void
visit(XSVisitor visitor)

Accepts a visitor.

Method Detail

applyback to summary
public <T> T apply(XSFunction<T> function)

Accepts a functor.

getAnnotationback to summary
public XSAnnotation getAnnotation()

Gets the annotation associated to this component, if any.

getAnnotationback to summary
public XSAnnotation getAnnotation(boolean createIfNotExist)

Works like getAnnotation(), but allow a new empty XSAnnotation to be created if not exist.

Parameters
createIfNotExist:boolean

true to create a new XSAnnotation if it doesn't exist already. false to make this method behavel like getAnnotation().

Returns:XSAnnotation

null if createIfNotExist==false and annotation didn't exist. Otherwise non-null.

getForeignAttributeback to summary
public String getForeignAttribute(String nsUri, String localName)

Gets the foreign attribute of the given name, or null if not found.

If multiple occurrences of the same attribute is found, this method returns the first one.

See Also
getForeignAttributes()
getForeignAttributesback to summary
public List<? extends ForeignAttributes> getForeignAttributes()

Gets the foreign attributes on this schema component.

In general, a schema component may match multiple elements in a schema document, and those elements can individually carry foreign attributes.

This method returns a list of ForeignAttributes, where each ForeignAttributes object represent foreign attributes on one element.

Returns:List<? extends ForeignAttributes>

can be an empty list but never be null.

getLocatorback to summary
public Locator getLocator()

Gets the locator that indicates the source location where this component is created from, or null if no information is available.

getOwnerSchemaback to summary
public XSSchema getOwnerSchema()

Gets a reference to the XSSchema object to which this component belongs.

In case of XSEmpty component, this method returns null since there is no owner component.

getRootback to summary
public XSSchemaSet getRoot()

Gets the root schema set that includes this component.

In case of XSEmpty component, this method returns null since there is no owner component.

getSourceDocumentback to summary
public SchemaDocument getSourceDocument()

Gets the SchemaDocument that indicates which document this component was defined in.

Returns:SchemaDocument

null for components that are built-in to XML Schema, such as anyType, or "empty" XSContentType. This method also returns null for XSSchema. For all other user-defined components this method returns non-null, even if they are local.

selectback to summary
public Collection<XSComponent> select(String scd, NamespaceContext nsContext)

Evaluates a schema component designator against this schema component and returns the resulting schema components.

Parameters
scd:String

Schema component designator. See SCD for more details.

nsContext:NamespaceContext

The namespace context in which SCD is evaluated. Cannot be null.

Returns:Collection<XSComponent>

Can be empty but never null.

Exceptions
IllegalArgumentException:
if SCD is syntactically incorrect.
selectSingleback to summary
public XSComponent selectSingle(String scd, NamespaceContext nsContext)

Evaluates a schema component designator against this schema component and returns the first resulting schema component.

Parameters
scd:String

Schema component designator. See SCD for more details.

nsContext:NamespaceContext

The namespace context in which SCD is evaluated. Cannot be null.

Returns:XSComponent

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

Exceptions
IllegalArgumentException:
if SCD is syntactically incorrect.
visitback to summary
public void visit(XSVisitor visitor)

Accepts a visitor.