public class SchemaImpl extends java.lang.Object implements XSSchema
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,XSType> |
allTypes |
private java.util.Map<java.lang.String,XSType> |
allTypesView |
private XSAnnotation |
annotation |
private java.util.Map<java.lang.String,XSAttGroupDecl> |
attGroups |
private java.util.Map<java.lang.String,XSAttGroupDecl> |
attGroupsView |
private java.util.Map<java.lang.String,XSAttributeDecl> |
atts |
private java.util.Map<java.lang.String,XSAttributeDecl> |
attsView |
private java.util.Map<java.lang.String,XSComplexType> |
complexTypes |
private java.util.Map<java.lang.String,XSComplexType> |
complexTypesView |
private java.util.Map<java.lang.String,XSElementDecl> |
elems |
private java.util.Map<java.lang.String,XSElementDecl> |
elemsView |
private java.util.List<ForeignAttributes> |
foreignAttributes
Lazily created list of
ForeignAttributesImpl s. |
private java.util.Map<java.lang.String,XSIdentityConstraint> |
idConstraints |
private java.util.Map<java.lang.String,XSIdentityConstraint> |
idConstraintsView |
private org.xml.sax.Locator |
locator |
private java.util.Map<java.lang.String,XSModelGroupDecl> |
modelGroups |
private java.util.Map<java.lang.String,XSModelGroupDecl> |
modelGroupsView |
private java.util.Map<java.lang.String,XSNotation> |
notations |
private java.util.Map<java.lang.String,XSNotation> |
notationsView |
protected SchemaSetImpl |
parent |
private java.util.List<ForeignAttributes> |
readOnlyForeignAttributes |
private java.util.Map<java.lang.String,XSSimpleType> |
simpleTypes |
private java.util.Map<java.lang.String,XSSimpleType> |
simpleTypesView |
private java.lang.String |
targetNamespace |
Constructor and Description |
---|
SchemaImpl(SchemaSetImpl _parent,
org.xml.sax.Locator loc,
java.lang.String tns) |
Modifier and Type | Method and 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 like
XSComponent.getAnnotation() , but allow a new empty XSAnnotation to be created
if not exist. |
XSAttGroupDecl |
getAttGroupDecl(java.lang.String name) |
java.util.Map<java.lang.String,XSAttGroupDecl> |
getAttGroupDecls()
Gets all the
XSAttGroupDecl s in this schema. |
XSAttributeDecl |
getAttributeDecl(java.lang.String name) |
java.util.Map<java.lang.String,XSAttributeDecl> |
getAttributeDecls()
Gets all the
XSAttributeDecl 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 the
XSComplexType s in this schema. |
XSElementDecl |
getElementDecl(java.lang.String name) |
java.util.Map<java.lang.String,XSElementDecl> |
getElementDecls()
Gets all the
XSElementDecl 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 the
XSIdentityConstraint 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 the
XSModelGroupDecl s in this schema. |
XSNotation |
getNotation(java.lang.String name) |
java.util.Map<java.lang.String,XSNotation> |
getNotations()
Gets all the
XSNotation s in this schema. |
XSSchema |
getOwnerSchema()
Gets a reference to the
XSSchema 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 the
XSSimpleType s in this schema. |
SchemaDocument |
getSourceDocument()
Sine an
XSSchema 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 the
XSType s in this schema (union of
XSSchema.getSimpleTypes() and XSSchema.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.
|
protected final SchemaSetImpl parent
private final java.lang.String targetNamespace
private XSAnnotation annotation
private final org.xml.sax.Locator locator
private final java.util.Map<java.lang.String,XSAttributeDecl> atts
private final java.util.Map<java.lang.String,XSAttributeDecl> attsView
private final java.util.Map<java.lang.String,XSElementDecl> elems
private final java.util.Map<java.lang.String,XSElementDecl> elemsView
private final java.util.Map<java.lang.String,XSAttGroupDecl> attGroups
private final java.util.Map<java.lang.String,XSAttGroupDecl> attGroupsView
private final java.util.Map<java.lang.String,XSNotation> notations
private final java.util.Map<java.lang.String,XSNotation> notationsView
private final java.util.Map<java.lang.String,XSModelGroupDecl> modelGroups
private final java.util.Map<java.lang.String,XSModelGroupDecl> modelGroupsView
private final java.util.Map<java.lang.String,XSIdentityConstraint> idConstraints
private final java.util.Map<java.lang.String,XSIdentityConstraint> idConstraintsView
private final java.util.Map<java.lang.String,XSType> allTypes
private final java.util.Map<java.lang.String,XSType> allTypesView
private final java.util.Map<java.lang.String,XSSimpleType> simpleTypes
private final java.util.Map<java.lang.String,XSSimpleType> simpleTypesView
private final java.util.Map<java.lang.String,XSComplexType> complexTypes
private final java.util.Map<java.lang.String,XSComplexType> complexTypesView
private java.util.List<ForeignAttributes> foreignAttributes
ForeignAttributesImpl
s.private java.util.List<ForeignAttributes> readOnlyForeignAttributes
public SchemaImpl(SchemaSetImpl _parent, org.xml.sax.Locator loc, java.lang.String tns)
public SchemaDocument getSourceDocument()
XSSchema
XSSchema
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.getSourceDocument
in interface XSComponent
getSourceDocument
in interface XSSchema
XSContentType
. This method also
returns null for XSSchema
.
For all other user-defined
components this method returns non-null, even if they are local.public SchemaSetImpl getRoot()
XSSchema
getRoot
in interface XSComponent
getRoot
in interface XSSchema
public java.lang.String getTargetNamespace()
XSSchema
getTargetNamespace
in interface XSSchema
public XSSchema getOwnerSchema()
XSComponent
XSSchema
object to which this component
belongs.
In case of XSEmpty
component, this method
returns null since there is no owner component.
getOwnerSchema
in interface XSComponent
public void setAnnotation(XSAnnotation a)
public XSAnnotation getAnnotation()
XSComponent
getAnnotation
in interface XSComponent
public XSAnnotation getAnnotation(boolean createIfNotExist)
XSComponent
XSComponent.getAnnotation()
, but allow a new empty XSAnnotation
to be created
if not exist.getAnnotation
in interface XSComponent
createIfNotExist
- true to create a new XSAnnotation
if it doesn't exist already.
false to make this method behavel like XSComponent.getAnnotation()
.public org.xml.sax.Locator getLocator()
XSComponent
getLocator
in interface XSComponent
public void addAttributeDecl(XSAttributeDecl newDecl)
public java.util.Map<java.lang.String,XSAttributeDecl> getAttributeDecls()
XSSchema
XSAttributeDecl
s in this schema
keyed by their local names.getAttributeDecls
in interface XSSchema
public XSAttributeDecl getAttributeDecl(java.lang.String name)
getAttributeDecl
in interface XSSchema
public java.util.Iterator<XSAttributeDecl> iterateAttributeDecls()
iterateAttributeDecls
in interface XSSchema
public void addElementDecl(XSElementDecl newDecl)
public java.util.Map<java.lang.String,XSElementDecl> getElementDecls()
XSSchema
XSElementDecl
s in this schema.getElementDecls
in interface XSSchema
public XSElementDecl getElementDecl(java.lang.String name)
getElementDecl
in interface XSSchema
public java.util.Iterator<XSElementDecl> iterateElementDecls()
iterateElementDecls
in interface XSSchema
public void addAttGroupDecl(XSAttGroupDecl newDecl, boolean overwrite)
public java.util.Map<java.lang.String,XSAttGroupDecl> getAttGroupDecls()
XSSchema
XSAttGroupDecl
s in this schema.getAttGroupDecls
in interface XSSchema
public XSAttGroupDecl getAttGroupDecl(java.lang.String name)
getAttGroupDecl
in interface XSSchema
public java.util.Iterator<XSAttGroupDecl> iterateAttGroupDecls()
iterateAttGroupDecls
in interface XSSchema
public void addNotation(XSNotation newDecl)
public java.util.Map<java.lang.String,XSNotation> getNotations()
XSSchema
XSNotation
s in this schema.getNotations
in interface XSSchema
public XSNotation getNotation(java.lang.String name)
getNotation
in interface XSSchema
public java.util.Iterator<XSNotation> iterateNotations()
iterateNotations
in interface XSSchema
public void addModelGroupDecl(XSModelGroupDecl newDecl, boolean overwrite)
public java.util.Map<java.lang.String,XSModelGroupDecl> getModelGroupDecls()
XSSchema
XSModelGroupDecl
s in this schema.getModelGroupDecls
in interface XSSchema
public XSModelGroupDecl getModelGroupDecl(java.lang.String name)
getModelGroupDecl
in interface XSSchema
public java.util.Iterator<XSModelGroupDecl> iterateModelGroupDecls()
iterateModelGroupDecls
in interface XSSchema
protected void addIdentityConstraint(IdentityConstraintImpl c)
public java.util.Map<java.lang.String,XSIdentityConstraint> getIdentityConstraints()
XSSchema
XSIdentityConstraint
s in this schema,
keyed by their names.getIdentityConstraints
in interface XSSchema
public XSIdentityConstraint getIdentityConstraint(java.lang.String localName)
XSSchema
getIdentityConstraint
in interface XSSchema
public void addSimpleType(XSSimpleType newDecl, boolean overwrite)
public java.util.Map<java.lang.String,XSSimpleType> getSimpleTypes()
XSSchema
XSSimpleType
s in this schema.getSimpleTypes
in interface XSSchema
public XSSimpleType getSimpleType(java.lang.String name)
getSimpleType
in interface XSSchema
public java.util.Iterator<XSSimpleType> iterateSimpleTypes()
iterateSimpleTypes
in interface XSSchema
public void addComplexType(XSComplexType newDecl, boolean overwrite)
public java.util.Map<java.lang.String,XSComplexType> getComplexTypes()
XSSchema
XSComplexType
s in this schema.getComplexTypes
in interface XSSchema
public XSComplexType getComplexType(java.lang.String name)
getComplexType
in interface XSSchema
public java.util.Iterator<XSComplexType> iterateComplexTypes()
iterateComplexTypes
in interface XSSchema
public java.util.Map<java.lang.String,XSType> getTypes()
XSSchema
XSType
s in this schema (union of
XSSchema.getSimpleTypes()
and XSSchema.getComplexTypes()
public java.util.Iterator<XSType> iterateTypes()
iterateTypes
in interface XSSchema
public void visit(XSVisitor visitor)
XSComponent
visit
in interface XSComponent
public java.lang.Object apply(XSFunction function)
XSComponent
apply
in interface XSComponent
public void addForeignAttributes(ForeignAttributesImpl fa)
public java.util.List<ForeignAttributes> getForeignAttributes()
XSComponent
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.
getForeignAttributes
in interface XSComponent
public java.lang.String getForeignAttribute(java.lang.String nsUri, java.lang.String localName)
XSComponent
If multiple occurences of the same attribute is found, this method returns the first one.
getForeignAttribute
in interface XSComponent
XSComponent.getForeignAttributes()
public java.util.Collection<XSComponent> select(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
XSComponent
select
in interface XSComponent
scd
- Schema component designator. See SCD
for more details.nsContext
- The namespace context in which SCD is evaluated. Cannot be null.public XSComponent selectSingle(java.lang.String scd, javax.xml.namespace.NamespaceContext nsContext)
XSComponent
selectSingle
in interface XSComponent
scd
- Schema component designator. See SCD
for more details.nsContext
- The namespace context in which SCD is evaluated. Cannot be null.