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 java.lang.Object implements XSSchema
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemaSetImpl
parent
-
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 void
addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
void
addAttributeDecl(XSAttributeDecl newDecl)
void
addComplexType(XSComplexType newDecl, boolean overwrite)
void
addElementDecl(XSElementDecl newDecl)
void
addForeignAttributes(ForeignAttributesImpl fa)
protected void
addIdentityConstraint(IdentityConstraintImpl c)
void
addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
void
addNotation(XSNotation newDecl)
void
addSimpleType(XSSimpleType newDecl, boolean overwrite)
java.lang.Object
apply(XSFunction function)
Accepts a functor.XSAnnotation
getAnnotation()
Gets the annotation associated to this component, if any.XSAnnotation
getAnnotation(boolean createIfNotExist)
Works likeXSComponent.getAnnotation()
, but allow a new emptyXSAnnotation
to be created if not exist.XSAttGroupDecl
getAttGroupDecl(java.lang.String name)
java.util.Map<java.lang.String,XSAttGroupDecl>
getAttGroupDecls()
Gets all theXSAttGroupDecl
s in this schema.XSAttributeDecl
getAttributeDecl(java.lang.String name)
java.util.Map<java.lang.String,XSAttributeDecl>
getAttributeDecls()
Gets all theXSAttributeDecl
s in this schema keyed by their local names.XSComplexType
getComplexType(java.lang.String name)
java.util.Map<java.lang.String,XSComplexType>
getComplexTypes()
Gets all theXSComplexType
s in this schema.XSElementDecl
getElementDecl(java.lang.String name)
java.util.Map<java.lang.String,XSElementDecl>
getElementDecls()
Gets all theXSElementDecl
s in this schema.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.java.util.List<ForeignAttributes>
getForeignAttributes()
Gets the foreign attributes on this schema component.XSIdentityConstraint
getIdentityConstraint(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 theXSIdentityConstraint
s in this schema, keyed by their names.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.XSModelGroupDecl
getModelGroupDecl(java.lang.String name)
java.util.Map<java.lang.String,XSModelGroupDecl>
getModelGroupDecls()
Gets all theXSModelGroupDecl
s in this schema.XSNotation
getNotation(java.lang.String name)
java.util.Map<java.lang.String,XSNotation>
getNotations()
Gets all theXSNotation
s in this schema.XSSchema
getOwnerSchema()
Gets a reference to theXSSchema
object to which this component belongs.SchemaSetImpl
getRoot()
Gets the root schema set that includes this schema.XSSimpleType
getSimpleType(java.lang.String name)
java.util.Map<java.lang.String,XSSimpleType>
getSimpleTypes()
Gets all theXSSimpleType
s in this schema.SchemaDocument
getSourceDocument()
Sine anXSSchema
is 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.String
getTargetNamespace()
Gets the target namespace of the schema.XSType
getType(java.lang.String name)
java.util.Map<java.lang.String,XSType>
getTypes()
Gets all theXSType
s 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.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.void
setAnnotation(XSAnnotation a)
void
visit(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:XSSchema
Sine anXSSchema
is 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:
getSourceDocument
in interfaceXSComponent
- Specified by:
getSourceDocument
in 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:XSSchema
Gets the root schema set that includes this schema.- Specified by:
getRoot
in interfaceXSComponent
- Specified by:
getRoot
in interfaceXSSchema
- Returns:
- never null.
-
getTargetNamespace
public java.lang.String getTargetNamespace()
Description copied from interface:XSSchema
Gets the target namespace of the schema.- Specified by:
getTargetNamespace
in interfaceXSSchema
- Returns:
- can be empty, but never be null.
-
getOwnerSchema
public XSSchema getOwnerSchema()
Description copied from interface:XSComponent
Gets a reference to theXSSchema
object to which this component belongs.In case of
XSEmpty
component, this method returns null since there is no owner component.- Specified by:
getOwnerSchema
in interfaceXSComponent
-
setAnnotation
public void setAnnotation(XSAnnotation a)
-
getAnnotation
public XSAnnotation getAnnotation()
Description copied from interface:XSComponent
Gets the annotation associated to this component, if any.- Specified by:
getAnnotation
in interfaceXSComponent
-
getAnnotation
public XSAnnotation getAnnotation(boolean createIfNotExist)
Description copied from interface:XSComponent
Works likeXSComponent.getAnnotation()
, but allow a new emptyXSAnnotation
to be created if not exist.- Specified by:
getAnnotation
in interfaceXSComponent
- Parameters:
createIfNotExist
- true to create a newXSAnnotation
if it doesn't exist already. false to make this method behavel likeXSComponent.getAnnotation()
.- Returns:
- null if
createIfNotExist==false
and annotation didn't exist. Otherwise non-null.
-
getLocator
public org.xml.sax.Locator getLocator()
Description copied from interface:XSComponent
Gets the locator that indicates the source location where this component is created from, or null if no information is available.- Specified by:
getLocator
in interfaceXSComponent
-
addAttributeDecl
public void addAttributeDecl(XSAttributeDecl newDecl)
-
getAttributeDecls
public java.util.Map<java.lang.String,XSAttributeDecl> getAttributeDecls()
Description copied from interface:XSSchema
Gets all theXSAttributeDecl
s in this schema keyed by their local names.- Specified by:
getAttributeDecls
in interfaceXSSchema
-
getAttributeDecl
public XSAttributeDecl getAttributeDecl(java.lang.String name)
- Specified by:
getAttributeDecl
in interfaceXSSchema
-
iterateAttributeDecls
public java.util.Iterator<XSAttributeDecl> iterateAttributeDecls()
- Specified by:
iterateAttributeDecls
in interfaceXSSchema
-
addElementDecl
public void addElementDecl(XSElementDecl newDecl)
-
getElementDecls
public java.util.Map<java.lang.String,XSElementDecl> getElementDecls()
Description copied from interface:XSSchema
Gets all theXSElementDecl
s in this schema.- Specified by:
getElementDecls
in interfaceXSSchema
-
getElementDecl
public XSElementDecl getElementDecl(java.lang.String name)
- Specified by:
getElementDecl
in interfaceXSSchema
-
iterateElementDecls
public java.util.Iterator<XSElementDecl> iterateElementDecls()
- Specified by:
iterateElementDecls
in interfaceXSSchema
-
addAttGroupDecl
public void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
-
getAttGroupDecls
public java.util.Map<java.lang.String,XSAttGroupDecl> getAttGroupDecls()
Description copied from interface:XSSchema
Gets all theXSAttGroupDecl
s in this schema.- Specified by:
getAttGroupDecls
in interfaceXSSchema
-
getAttGroupDecl
public XSAttGroupDecl getAttGroupDecl(java.lang.String name)
- Specified by:
getAttGroupDecl
in interfaceXSSchema
-
iterateAttGroupDecls
public java.util.Iterator<XSAttGroupDecl> iterateAttGroupDecls()
- Specified by:
iterateAttGroupDecls
in interfaceXSSchema
-
addNotation
public void addNotation(XSNotation newDecl)
-
getNotations
public java.util.Map<java.lang.String,XSNotation> getNotations()
Description copied from interface:XSSchema
Gets all theXSNotation
s in this schema.- Specified by:
getNotations
in interfaceXSSchema
-
getNotation
public XSNotation getNotation(java.lang.String name)
- Specified by:
getNotation
in interfaceXSSchema
-
iterateNotations
public java.util.Iterator<XSNotation> iterateNotations()
- Specified by:
iterateNotations
in interfaceXSSchema
-
addModelGroupDecl
public void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
-
getModelGroupDecls
public java.util.Map<java.lang.String,XSModelGroupDecl> getModelGroupDecls()
Description copied from interface:XSSchema
Gets all theXSModelGroupDecl
s in this schema.- Specified by:
getModelGroupDecls
in interfaceXSSchema
-
getModelGroupDecl
public XSModelGroupDecl getModelGroupDecl(java.lang.String name)
- Specified by:
getModelGroupDecl
in interfaceXSSchema
-
iterateModelGroupDecls
public java.util.Iterator<XSModelGroupDecl> iterateModelGroupDecls()
- Specified by:
iterateModelGroupDecls
in interfaceXSSchema
-
addIdentityConstraint
protected void addIdentityConstraint(IdentityConstraintImpl c)
-
getIdentityConstraints
public java.util.Map<java.lang.String,XSIdentityConstraint> getIdentityConstraints()
Description copied from interface:XSSchema
Gets all theXSIdentityConstraint
s in this schema, keyed by their names.- Specified by:
getIdentityConstraints
in interfaceXSSchema
-
getIdentityConstraint
public XSIdentityConstraint getIdentityConstraint(java.lang.String localName)
Description copied from interface:XSSchema
Gets the identity constraint of the given name, or null if not found.- Specified by:
getIdentityConstraint
in interfaceXSSchema
-
addSimpleType
public void addSimpleType(XSSimpleType newDecl, boolean overwrite)
-
getSimpleTypes
public java.util.Map<java.lang.String,XSSimpleType> getSimpleTypes()
Description copied from interface:XSSchema
Gets all theXSSimpleType
s in this schema.- Specified by:
getSimpleTypes
in interfaceXSSchema
-
getSimpleType
public XSSimpleType getSimpleType(java.lang.String name)
- Specified by:
getSimpleType
in interfaceXSSchema
-
iterateSimpleTypes
public java.util.Iterator<XSSimpleType> iterateSimpleTypes()
- Specified by:
iterateSimpleTypes
in interfaceXSSchema
-
addComplexType
public void addComplexType(XSComplexType newDecl, boolean overwrite)
-
getComplexTypes
public java.util.Map<java.lang.String,XSComplexType> getComplexTypes()
Description copied from interface:XSSchema
Gets all theXSComplexType
s in this schema.- Specified by:
getComplexTypes
in interfaceXSSchema
-
getComplexType
public XSComplexType getComplexType(java.lang.String name)
- Specified by:
getComplexType
in interfaceXSSchema
-
iterateComplexTypes
public java.util.Iterator<XSComplexType> iterateComplexTypes()
- Specified by:
iterateComplexTypes
in interfaceXSSchema
-
getTypes
public java.util.Map<java.lang.String,XSType> getTypes()
Description copied from interface:XSSchema
Gets all theXSType
s in this schema (union ofXSSchema.getSimpleTypes()
andXSSchema.getComplexTypes()
-
iterateTypes
public java.util.Iterator<XSType> iterateTypes()
- Specified by:
iterateTypes
in interfaceXSSchema
-
visit
public void visit(XSVisitor visitor)
Description copied from interface:XSComponent
Accepts a visitor.- Specified by:
visit
in interfaceXSComponent
-
apply
public java.lang.Object apply(XSFunction function)
Description copied from interface:XSComponent
Accepts a functor.- Specified by:
apply
in interfaceXSComponent
-
addForeignAttributes
public void addForeignAttributes(ForeignAttributesImpl fa)
-
getForeignAttributes
public java.util.List<ForeignAttributes> getForeignAttributes()
Description copied from interface:XSComponent
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 eachForeignAttributes
object represent foreign attributes on one element.- Specified by:
getForeignAttributes
in 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:XSComponent
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.
- Specified by:
getForeignAttribute
in 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:XSComponent
Evaluates a schema component designator against this schema component and returns the resulting schema components.- Specified by:
select
in interfaceXSComponent
- Parameters:
scd
- Schema component designator. SeeSCD
for 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:XSComponent
Evaluates a schema component designator against this schema component and returns the first resulting schema component.- Specified by:
selectSingle
in interfaceXSComponent
- Parameters:
scd
- Schema component designator. SeeSCD
for 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.
-
-