- java.lang.Object
-
- com.sun.xml.xsom.impl.SchemaImpl
-
- All Implemented Interfaces:
XSComponent,XSSchema
public class SchemaImpl extends java.lang.Object implements XSSchema
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaSetImplparent
-
Constructor Summary
Constructors Constructor Description SchemaImpl(SchemaSetImpl _parent, org.xml.sax.Locator loc, java.lang.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)java.lang.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(java.lang.String name)java.util.Map<java.lang.String,XSAttGroupDecl>getAttGroupDecls()Gets all theXSAttGroupDecls in this schema.XSAttributeDeclgetAttributeDecl(java.lang.String name)java.util.Map<java.lang.String,XSAttributeDecl>getAttributeDecls()Gets all theXSAttributeDecls in this schema keyed by their local names.XSComplexTypegetComplexType(java.lang.String name)java.util.Map<java.lang.String,XSComplexType>getComplexTypes()Gets all theXSComplexTypes in this schema.XSElementDeclgetElementDecl(java.lang.String name)java.util.Map<java.lang.String,XSElementDecl>getElementDecls()Gets all theXSElementDecls in this schema.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<ForeignAttributes>getForeignAttributes()Gets the foreign attributes on this schema component.XSIdentityConstraintgetIdentityConstraint(java.lang.String localName)Gets the identity constraint of the given name, or null if not found.java.util.Map<java.lang.String,XSIdentityConstraint>getIdentityConstraints()Gets all theXSIdentityConstraints in this schema, keyed by their names.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.XSModelGroupDeclgetModelGroupDecl(java.lang.String name)java.util.Map<java.lang.String,XSModelGroupDecl>getModelGroupDecls()Gets all theXSModelGroupDecls in this schema.XSNotationgetNotation(java.lang.String name)java.util.Map<java.lang.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(java.lang.String name)java.util.Map<java.lang.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.java.lang.StringgetTargetNamespace()Gets the target namespace of the schema.XSTypegetType(java.lang.String name)java.util.Map<java.lang.String,XSType>getTypes()Gets all theXSTypes in this schema (union ofXSSchema.getSimpleTypes()andXSSchema.getComplexTypes()java.util.Iterator<XSAttGroupDecl>iterateAttGroupDecls()java.util.Iterator<XSAttributeDecl>iterateAttributeDecls()java.util.Iterator<XSComplexType>iterateComplexTypes()java.util.Iterator<XSElementDecl>iterateElementDecls()java.util.Iterator<XSModelGroupDecl>iterateModelGroupDecls()java.util.Iterator<XSNotation>iterateNotations()java.util.Iterator<XSSimpleType>iterateSimpleTypes()java.util.Iterator<XSType>iterateTypes()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.voidsetAnnotation(XSAnnotation a)voidvisit(XSVisitor visitor)Accepts a visitor.
-
-
-
Field Detail
-
parent
protected final SchemaSetImpl parent
-
-
Constructor Detail
-
SchemaImpl
public SchemaImpl(SchemaSetImpl _parent, org.xml.sax.Locator loc, java.lang.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 java.lang.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 org.xml.sax.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 java.util.Map<java.lang.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(java.lang.String name)
- Specified by:
getAttributeDeclin interfaceXSSchema
-
iterateAttributeDecls
public java.util.Iterator<XSAttributeDecl> iterateAttributeDecls()
- Specified by:
iterateAttributeDeclsin interfaceXSSchema
-
addElementDecl
public void addElementDecl(XSElementDecl newDecl)
-
getElementDecls
public java.util.Map<java.lang.String,XSElementDecl> getElementDecls()
Description copied from interface:XSSchemaGets all theXSElementDecls in this schema.- Specified by:
getElementDeclsin interfaceXSSchema
-
getElementDecl
public XSElementDecl getElementDecl(java.lang.String name)
- Specified by:
getElementDeclin interfaceXSSchema
-
iterateElementDecls
public java.util.Iterator<XSElementDecl> iterateElementDecls()
- Specified by:
iterateElementDeclsin interfaceXSSchema
-
addAttGroupDecl
public void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
-
getAttGroupDecls
public java.util.Map<java.lang.String,XSAttGroupDecl> getAttGroupDecls()
Description copied from interface:XSSchemaGets all theXSAttGroupDecls in this schema.- Specified by:
getAttGroupDeclsin interfaceXSSchema
-
getAttGroupDecl
public XSAttGroupDecl getAttGroupDecl(java.lang.String name)
- Specified by:
getAttGroupDeclin interfaceXSSchema
-
iterateAttGroupDecls
public java.util.Iterator<XSAttGroupDecl> iterateAttGroupDecls()
- Specified by:
iterateAttGroupDeclsin interfaceXSSchema
-
addNotation
public void addNotation(XSNotation newDecl)
-
getNotations
public java.util.Map<java.lang.String,XSNotation> getNotations()
Description copied from interface:XSSchemaGets all theXSNotations in this schema.- Specified by:
getNotationsin interfaceXSSchema
-
getNotation
public XSNotation getNotation(java.lang.String name)
- Specified by:
getNotationin interfaceXSSchema
-
iterateNotations
public java.util.Iterator<XSNotation> iterateNotations()
- Specified by:
iterateNotationsin interfaceXSSchema
-
addModelGroupDecl
public void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
-
getModelGroupDecls
public java.util.Map<java.lang.String,XSModelGroupDecl> getModelGroupDecls()
Description copied from interface:XSSchemaGets all theXSModelGroupDecls in this schema.- Specified by:
getModelGroupDeclsin interfaceXSSchema
-
getModelGroupDecl
public XSModelGroupDecl getModelGroupDecl(java.lang.String name)
- Specified by:
getModelGroupDeclin interfaceXSSchema
-
iterateModelGroupDecls
public java.util.Iterator<XSModelGroupDecl> iterateModelGroupDecls()
- Specified by:
iterateModelGroupDeclsin interfaceXSSchema
-
addIdentityConstraint
protected void addIdentityConstraint(IdentityConstraintImpl c)
-
getIdentityConstraints
public java.util.Map<java.lang.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(java.lang.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 java.util.Map<java.lang.String,XSSimpleType> getSimpleTypes()
Description copied from interface:XSSchemaGets all theXSSimpleTypes in this schema.- Specified by:
getSimpleTypesin interfaceXSSchema
-
getSimpleType
public XSSimpleType getSimpleType(java.lang.String name)
- Specified by:
getSimpleTypein interfaceXSSchema
-
iterateSimpleTypes
public java.util.Iterator<XSSimpleType> iterateSimpleTypes()
- Specified by:
iterateSimpleTypesin interfaceXSSchema
-
addComplexType
public void addComplexType(XSComplexType newDecl, boolean overwrite)
-
getComplexTypes
public java.util.Map<java.lang.String,XSComplexType> getComplexTypes()
Description copied from interface:XSSchemaGets all theXSComplexTypes in this schema.- Specified by:
getComplexTypesin interfaceXSSchema
-
getComplexType
public XSComplexType getComplexType(java.lang.String name)
- Specified by:
getComplexTypein interfaceXSSchema
-
iterateComplexTypes
public java.util.Iterator<XSComplexType> iterateComplexTypes()
- Specified by:
iterateComplexTypesin interfaceXSSchema
-
getTypes
public java.util.Map<java.lang.String,XSType> getTypes()
Description copied from interface:XSSchemaGets all theXSTypes in this schema (union ofXSSchema.getSimpleTypes()andXSSchema.getComplexTypes()
-
iterateTypes
public java.util.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 java.lang.Object apply(XSFunction function)
Description copied from interface:XSComponentAccepts a functor.- Specified by:
applyin interfaceXSComponent
-
addForeignAttributes
public void addForeignAttributes(ForeignAttributesImpl fa)
-
getForeignAttributes
public java.util.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 java.lang.String getForeignAttribute(java.lang.String nsUri, java.lang.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 java.util.Collection<XSComponent> select(java.lang.String scd, javax.xml.namespace.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(java.lang.String scd, javax.xml.namespace.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.
-
-