Package com.sun.xml.xsom.impl
Class SchemaImpl
- java.lang.Object
-
- com.sun.xml.xsom.impl.SchemaImpl
-
- All Implemented Interfaces:
XSComponent,XSSchema
public class SchemaImpl extends Object implements XSSchema
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaSetImplparent
-
Constructor Summary
Constructors Constructor Description SchemaImpl(SchemaSetImpl _parent, Locator loc, String tns)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)voidaddAttributeDecl(XSAttributeDecl newDecl)voidaddComplexType(XSComplexType newDecl, boolean overwrite)voidaddElementDecl(XSElementDecl newDecl)voidaddForeignAttributes(ForeignAttributesImpl fa)protected voidaddIdentityConstraint(IdentityConstraintImpl c)voidaddModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)voidaddNotation(XSNotation newDecl)voidaddSimpleType(XSSimpleType newDecl, boolean overwrite)Objectapply(XSFunction function)Accepts a functor.XSAnnotationgetAnnotation()Gets the annotation associated to this component, if any.XSAnnotationgetAnnotation(boolean createIfNotExist)Works likeXSComponent.getAnnotation(), but allow a new emptyXSAnnotationto be created if not exist.XSAttGroupDeclgetAttGroupDecl(String name)Map<String,XSAttGroupDecl>getAttGroupDecls()Gets all theXSAttGroupDecls in this schema.XSAttributeDeclgetAttributeDecl(String name)Map<String,XSAttributeDecl>getAttributeDecls()Gets all theXSAttributeDecls in this schema keyed by their local names.XSComplexTypegetComplexType(String name)Map<String,XSComplexType>getComplexTypes()Gets all theXSComplexTypes in this schema.XSElementDeclgetElementDecl(String name)Map<String,XSElementDecl>getElementDecls()Gets all theXSElementDecls in this schema.StringgetForeignAttribute(String nsUri, String localName)Gets the foreign attribute of the given name, or null if not found.List<ForeignAttributes>getForeignAttributes()Gets the foreign attributes on this schema component.XSIdentityConstraintgetIdentityConstraint(String localName)Gets the identity constraint of the given name, or null if not found.Map<String,XSIdentityConstraint>getIdentityConstraints()Gets all theXSIdentityConstraints in this schema, keyed by their names.LocatorgetLocator()Gets the locator that indicates the source location where this component is created from, or null if no information is available.XSModelGroupDeclgetModelGroupDecl(String name)Map<String,XSModelGroupDecl>getModelGroupDecls()Gets all theXSModelGroupDecls in this schema.XSNotationgetNotation(String name)Map<String,XSNotation>getNotations()Gets all theXSNotations in this schema.XSSchemagetOwnerSchema()Gets a reference to theXSSchemaobject to which this component belongs.SchemaSetImplgetRoot()Gets the root schema set that includes this schema.XSSimpleTypegetSimpleType(String name)Map<String,XSSimpleType>getSimpleTypes()Gets all theXSSimpleTypes in this schema.SchemaDocumentgetSourceDocument()Sine anXSSchemais not necessarily defined in one schema document (for example one schema can span across many documents through<xs:include>s.), so this method always returns null.StringgetTargetNamespace()Gets the target namespace of the schema.XSTypegetType(String name)Map<String,XSType>getTypes()Gets all theXSTypes in this schema (union ofXSSchema.getSimpleTypes()andXSSchema.getComplexTypes()Iterator<XSAttGroupDecl>iterateAttGroupDecls()Iterator<XSAttributeDecl>iterateAttributeDecls()Iterator<XSComplexType>iterateComplexTypes()Iterator<XSElementDecl>iterateElementDecls()Iterator<XSModelGroupDecl>iterateModelGroupDecls()Iterator<XSNotation>iterateNotations()Iterator<XSSimpleType>iterateSimpleTypes()Iterator<XSType>iterateTypes()Collection<XSComponent>select(String scd, NamespaceContext nsContext)Evaluates a schema component designator against this schema component and returns the resulting schema components.XSComponentselectSingle(String scd, NamespaceContext nsContext)Evaluates a schema component designator against this schema component and returns the first resulting schema component.voidsetAnnotation(XSAnnotation a)voidvisit(XSVisitor visitor)Accepts a visitor.
-
-
-
Field Detail
-
parent
protected final SchemaSetImpl parent
-
-
Constructor Detail
-
SchemaImpl
public SchemaImpl(SchemaSetImpl _parent, Locator loc, String tns)
-
-
Method Detail
-
getSourceDocument
public SchemaDocument getSourceDocument()
Description copied from interface:XSSchemaSine anXSSchemais not necessarily defined in one schema document (for example one schema can span across many documents through<xs:include>s.), so this method always returns null.- Specified by:
getSourceDocumentin interfaceXSComponent- Specified by:
getSourceDocumentin interfaceXSSchema- 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.
-
getRoot
public SchemaSetImpl getRoot()
Description copied from interface:XSSchemaGets the root schema set that includes this schema.- Specified by:
getRootin interfaceXSComponent- Specified by:
getRootin interfaceXSSchema- Returns:
- never null.
-
getTargetNamespace
public String getTargetNamespace()
Description copied from interface:XSSchemaGets the target namespace of the schema.- Specified by:
getTargetNamespacein interfaceXSSchema- Returns:
- can be empty, but never be null.
-
getOwnerSchema
public XSSchema getOwnerSchema()
Description copied from interface:XSComponentGets a reference to theXSSchemaobject to which this component belongs.In case of
XSEmptycomponent, this method returns null since there is no owner component.- Specified by:
getOwnerSchemain interfaceXSComponent
-
setAnnotation
public void setAnnotation(XSAnnotation a)
-
getAnnotation
public XSAnnotation getAnnotation()
Description copied from interface:XSComponentGets the annotation associated to this component, if any.- Specified by:
getAnnotationin interfaceXSComponent
-
getAnnotation
public XSAnnotation getAnnotation(boolean createIfNotExist)
Description copied from interface:XSComponentWorks likeXSComponent.getAnnotation(), but allow a new emptyXSAnnotationto be created if not exist.- Specified by:
getAnnotationin interfaceXSComponent- Parameters:
createIfNotExist- true to create a newXSAnnotationif it doesn't exist already. false to make this method behavel likeXSComponent.getAnnotation().- Returns:
- null if
createIfNotExist==falseand annotation didn't exist. Otherwise non-null.
-
getLocator
public Locator getLocator()
Description copied from interface:XSComponentGets the locator that indicates the source location where this component is created from, or null if no information is available.- Specified by:
getLocatorin interfaceXSComponent
-
addAttributeDecl
public void addAttributeDecl(XSAttributeDecl newDecl)
-
getAttributeDecls
public Map<String,XSAttributeDecl> getAttributeDecls()
Description copied from interface:XSSchemaGets all theXSAttributeDecls in this schema keyed by their local names.- Specified by:
getAttributeDeclsin interfaceXSSchema
-
getAttributeDecl
public XSAttributeDecl getAttributeDecl(String name)
- Specified by:
getAttributeDeclin interfaceXSSchema
-
iterateAttributeDecls
public Iterator<XSAttributeDecl> iterateAttributeDecls()
- Specified by:
iterateAttributeDeclsin interfaceXSSchema
-
addElementDecl
public void addElementDecl(XSElementDecl newDecl)
-
getElementDecls
public Map<String,XSElementDecl> getElementDecls()
Description copied from interface:XSSchemaGets all theXSElementDecls in this schema.- Specified by:
getElementDeclsin interfaceXSSchema
-
getElementDecl
public XSElementDecl getElementDecl(String name)
- Specified by:
getElementDeclin interfaceXSSchema
-
iterateElementDecls
public Iterator<XSElementDecl> iterateElementDecls()
- Specified by:
iterateElementDeclsin interfaceXSSchema
-
addAttGroupDecl
public void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
-
getAttGroupDecls
public Map<String,XSAttGroupDecl> getAttGroupDecls()
Description copied from interface:XSSchemaGets all theXSAttGroupDecls in this schema.- Specified by:
getAttGroupDeclsin interfaceXSSchema
-
getAttGroupDecl
public XSAttGroupDecl getAttGroupDecl(String name)
- Specified by:
getAttGroupDeclin interfaceXSSchema
-
iterateAttGroupDecls
public Iterator<XSAttGroupDecl> iterateAttGroupDecls()
- Specified by:
iterateAttGroupDeclsin interfaceXSSchema
-
addNotation
public void addNotation(XSNotation newDecl)
-
getNotations
public Map<String,XSNotation> getNotations()
Description copied from interface:XSSchemaGets all theXSNotations in this schema.- Specified by:
getNotationsin interfaceXSSchema
-
getNotation
public XSNotation getNotation(String name)
- Specified by:
getNotationin interfaceXSSchema
-
iterateNotations
public Iterator<XSNotation> iterateNotations()
- Specified by:
iterateNotationsin interfaceXSSchema
-
addModelGroupDecl
public void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
-
getModelGroupDecls
public Map<String,XSModelGroupDecl> getModelGroupDecls()
Description copied from interface:XSSchemaGets all theXSModelGroupDecls in this schema.- Specified by:
getModelGroupDeclsin interfaceXSSchema
-
getModelGroupDecl
public XSModelGroupDecl getModelGroupDecl(String name)
- Specified by:
getModelGroupDeclin interfaceXSSchema
-
iterateModelGroupDecls
public Iterator<XSModelGroupDecl> iterateModelGroupDecls()
- Specified by:
iterateModelGroupDeclsin interfaceXSSchema
-
addIdentityConstraint
protected void addIdentityConstraint(IdentityConstraintImpl c)
-
getIdentityConstraints
public Map<String,XSIdentityConstraint> getIdentityConstraints()
Description copied from interface:XSSchemaGets all theXSIdentityConstraints in this schema, keyed by their names.- Specified by:
getIdentityConstraintsin interfaceXSSchema
-
getIdentityConstraint
public XSIdentityConstraint getIdentityConstraint(String localName)
Description copied from interface:XSSchemaGets the identity constraint of the given name, or null if not found.- Specified by:
getIdentityConstraintin interfaceXSSchema
-
addSimpleType
public void addSimpleType(XSSimpleType newDecl, boolean overwrite)
-
getSimpleTypes
public Map<String,XSSimpleType> getSimpleTypes()
Description copied from interface:XSSchemaGets all theXSSimpleTypes in this schema.- Specified by:
getSimpleTypesin interfaceXSSchema
-
getSimpleType
public XSSimpleType getSimpleType(String name)
- Specified by:
getSimpleTypein interfaceXSSchema
-
iterateSimpleTypes
public Iterator<XSSimpleType> iterateSimpleTypes()
- Specified by:
iterateSimpleTypesin interfaceXSSchema
-
addComplexType
public void addComplexType(XSComplexType newDecl, boolean overwrite)
-
getComplexTypes
public Map<String,XSComplexType> getComplexTypes()
Description copied from interface:XSSchemaGets all theXSComplexTypes in this schema.- Specified by:
getComplexTypesin interfaceXSSchema
-
getComplexType
public XSComplexType getComplexType(String name)
- Specified by:
getComplexTypein interfaceXSSchema
-
iterateComplexTypes
public Iterator<XSComplexType> iterateComplexTypes()
- Specified by:
iterateComplexTypesin interfaceXSSchema
-
getTypes
public Map<String,XSType> getTypes()
Description copied from interface:XSSchemaGets all theXSTypes in this schema (union ofXSSchema.getSimpleTypes()andXSSchema.getComplexTypes()
-
iterateTypes
public Iterator<XSType> iterateTypes()
- Specified by:
iterateTypesin interfaceXSSchema
-
visit
public void visit(XSVisitor visitor)
Description copied from interface:XSComponentAccepts a visitor.- Specified by:
visitin interfaceXSComponent
-
apply
public Object apply(XSFunction function)
Description copied from interface:XSComponentAccepts a functor.- Specified by:
applyin interfaceXSComponent
-
addForeignAttributes
public void addForeignAttributes(ForeignAttributesImpl fa)
-
getForeignAttributes
public List<ForeignAttributes> getForeignAttributes()
Description copied from interface:XSComponentGets 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.- Specified by:
getForeignAttributesin interfaceXSComponent- Returns:
- can be an empty list but never be null.
-
getForeignAttribute
public String getForeignAttribute(String nsUri, String localName)
Description copied from interface:XSComponentGets 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.
- Specified by:
getForeignAttributein interfaceXSComponent- See Also:
XSComponent.getForeignAttributes()
-
select
public Collection<XSComponent> select(String scd, NamespaceContext nsContext)
Description copied from interface:XSComponentEvaluates a schema component designator against this schema component and returns the resulting schema components.- Specified by:
selectin interfaceXSComponent- 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.
-
selectSingle
public XSComponent selectSingle(String scd, NamespaceContext nsContext)
Description copied from interface:XSComponentEvaluates a schema component designator against this schema component and returns the first resulting schema component.- Specified by:
selectSinglein interfaceXSComponent- 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.
-
-