Package com.sun.xml.xsom
Interface XSComponent
-
- All Known Subinterfaces:
XSAttContainer,XSAttGroupDecl,XSAttributeDecl,XSAttributeUse,XSComplexType,XSContentType,XSDeclaration,XSElementDecl,XSFacet,XSIdentityConstraint,XSListSimpleType,XSModelGroup,XSModelGroupDecl,XSNotation,XSParticle,XSRestrictionSimpleType,XSSchema,XSSimpleType,XSTerm,XSType,XSUnionSimpleType,XSWildcard,XSWildcard.Any,XSWildcard.Other,XSWildcard.Union,XSXPath
public interface XSComponentBase interface for all the schema components.- Author:
- Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tapply(com.sun.xml.xsom.visitor.XSFunction<T> function)Accepts a functor.XSAnnotationgetAnnotation()Gets the annotation associated to this component, if any.XSAnnotationgetAnnotation(boolean createIfNotExist)Works likegetAnnotation(), but allow a new emptyXSAnnotationto be created if not exist.java.lang.StringgetForeignAttribute(java.lang.String nsUri, java.lang.String localName)Gets the foreign attribute of the given name, or null if not found.java.util.List<? extends ForeignAttributes>getForeignAttributes()Gets the foreign attributes on this schema component.org.xml.sax.LocatorgetLocator()Gets the locator that indicates the source location where this component is created from, or null if no information is available.XSSchemagetOwnerSchema()Gets a reference to theXSSchemaobject to which this component belongs.XSSchemaSetgetRoot()Gets the root schema set that includes this component.com.sun.xml.xsom.parser.SchemaDocumentgetSourceDocument()Gets theSchemaDocumentthat indicates which document this component was defined in.java.util.Collection<XSComponent>select(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)Evaluates a schema component designator against this schema component and returns the resulting schema components.XSComponentselectSingle(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)Evaluates a schema component designator against this schema component and returns the first resulting schema component.voidvisit(com.sun.xml.xsom.visitor.XSVisitor visitor)Accepts a visitor.
-
-
-
Method Detail
-
getAnnotation
XSAnnotation getAnnotation()
Gets the annotation associated to this component, if any.
-
getAnnotation
XSAnnotation getAnnotation(boolean createIfNotExist)
Works likegetAnnotation(), but allow a new emptyXSAnnotationto be created if not exist.- Parameters:
createIfNotExist- true to create a newXSAnnotationif it doesn't exist already. false to make this method behavel likegetAnnotation().- Returns:
- null if
createIfNotExist==falseand annotation didn't exist. Otherwise non-null.
-
getForeignAttributes
java.util.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 eachForeignAttributesobject represent foreign attributes on one element.- Returns:
- can be an empty list but never be null.
-
getForeignAttribute
java.lang.String getForeignAttribute(java.lang.String nsUri, java.lang.String localName)Gets the foreign attribute of the given name, or null if not found.If multiple occurences of the same attribute is found, this method returns the first one.
- See Also:
getForeignAttributes()
-
getLocator
org.xml.sax.Locator getLocator()
Gets the locator that indicates the source location where this component is created from, or null if no information is available.
-
getOwnerSchema
XSSchema getOwnerSchema()
Gets a reference to theXSSchemaobject to which this component belongs.In case of
XSEmptycomponent, this method returns null since there is no owner component.
-
getRoot
XSSchemaSet getRoot()
Gets the root schema set that includes this component.In case of
XSEmptycomponent, this method returns null since there is no owner component.
-
getSourceDocument
com.sun.xml.xsom.parser.SchemaDocument getSourceDocument()
Gets theSchemaDocumentthat indicates which document this component was defined in.- Returns:
- null for components that are built-in to XML Schema, such
as anyType, or "empty"
XSContentType. This method also returns null forXSSchema. For all other user-defined components this method returns non-null, even if they are local.
-
select
java.util.Collection<XSComponent> select(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Evaluates a schema component designator against this schema component and returns the resulting schema components.- Parameters:
scd- Schema component designator. SeeSCDfor more details.nsContext- The namespace context in which SCD is evaluated. Cannot be null.- Returns:
- Can be empty but never null.
- Throws:
java.lang.IllegalArgumentException- if SCD is syntactically incorrect.
-
selectSingle
XSComponent selectSingle(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
Evaluates a schema component designator against this schema component and returns the first resulting schema component.- Parameters:
scd- Schema component designator. SeeSCDfor more details.nsContext- The namespace context in which SCD is evaluated. Cannot be null.- Returns:
- null if the SCD didn't match anything. If the SCD matched more than one node, the first one will be returned.
- Throws:
java.lang.IllegalArgumentException- if SCD is syntactically incorrect.
-
visit
void visit(com.sun.xml.xsom.visitor.XSVisitor visitor)
Accepts a visitor.
-
apply
<T> T apply(com.sun.xml.xsom.visitor.XSFunction<T> function)
Accepts a functor.
-
-