Methods Summary |
---|
private void | buildSubGroups()
SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
for (int i = 0 ; i < fGrammarCount; i++) {
sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
}
XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION);
int len = elements.getLength();
fSubGroupMap = new SymbolHash(len*2);
XSElementDecl head;
XSElementDeclaration[] subGroup;
for (int i = 0; i < len; i++) {
head = (XSElementDecl)elements.item(i);
subGroup = sgHandler.getSubstitutionGroup(head);
fSubGroupMap.put(head, subGroup.length > 0 ?
new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
}
|
public synchronized org.apache.xerces.xs.XSObjectList | getAnnotations(){annotations} A set of annotations.
if(fAnnotations != null)
return fAnnotations;
// do this in two passes to avoid inaccurate array size
int totalAnnotations = 0;
for (int i = 0; i < fGrammarCount; i++) {
totalAnnotations += fGrammarList[i].fNumAnnotations;
}
XSAnnotationImpl [] annotations = new XSAnnotationImpl [totalAnnotations];
int currPos = 0;
for (int i = 0; i < fGrammarCount; i++) {
SchemaGrammar currGrammar = fGrammarList[i];
if (currGrammar.fNumAnnotations > 0) {
System.arraycopy(currGrammar.fAnnotations, 0, annotations, currPos, currGrammar.fNumAnnotations);
currPos += currGrammar.fNumAnnotations;
}
}
fAnnotations = new XSObjectListImpl(annotations, annotations.length);
return fAnnotations;
|
public org.apache.xerces.xs.XSAttributeDeclaration | getAttributeDeclaration(java.lang.String name, java.lang.String namespace)Convenience method. Returns a top-level attribute declaration.
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSAttributeDeclaration)sg.fGlobalAttrDecls.get(name);
|
public org.apache.xerces.xs.XSAttributeGroupDefinition | getAttributeGroup(java.lang.String name, java.lang.String namespace)Convenience method. Returns a top-level attribute group definition.
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSAttributeGroupDefinition)sg.fGlobalAttrGrpDecls.get(name);
|
public synchronized org.apache.xerces.xs.XSNamedMap | getComponents(short objectType)Returns a list of top-level components, i.e. element declarations,
attribute declarations, etc.
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
SymbolHash[] tables = new SymbolHash[fGrammarCount];
// get all hashtables from all namespaces for this type of components
if (fGlobalComponents[objectType] == null) {
for (int i = 0; i < fGrammarCount; i++) {
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
tables[i] = fGrammarList[i].fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
tables[i] = fGrammarList[i].fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
tables[i] = fGrammarList[i].fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
tables[i] = fGrammarList[i].fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
tables[i] = fGrammarList[i].fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
tables[i] = fGrammarList[i].fGlobalNotationDecls;
break;
}
}
// for complex/simple types, create a special implementation,
// which take specific types out of the hash table
if (objectType == XSTypeDefinition.COMPLEX_TYPE ||
objectType == XSTypeDefinition.SIMPLE_TYPE) {
fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType);
}
else {
fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount);
}
}
return fGlobalComponents[objectType];
|
public synchronized org.apache.xerces.xs.XSNamedMap | getComponentsByNamespace(short objectType, java.lang.String namespace)Convenience method. Returns a list of top-level component declarations
that are defined within the specified namespace, i.e. element
declarations, attribute declarations, etc.
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
// try to find the grammar
int i = 0;
if (namespace != null) {
for (; i < fGrammarCount; ++i) {
if (namespace.equals(fNamespaces[i]))
break;
}
}
else {
for (; i < fGrammarCount; ++i) {
if (fNamespaces[i] == null)
break;
}
}
if (i == fGrammarCount)
return XSNamedMapImpl.EMPTY_MAP;
// get the hashtable for this type of components
if (fNSComponents[i][objectType] == null) {
SymbolHash table = null;
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
table = fGrammarList[i].fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
table = fGrammarList[i].fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
table = fGrammarList[i].fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
table = fGrammarList[i].fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
table = fGrammarList[i].fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
table = fGrammarList[i].fGlobalNotationDecls;
break;
}
// for complex/simple types, create a special implementation,
// which take specific types out of the hash table
if (objectType == XSTypeDefinition.COMPLEX_TYPE ||
objectType == XSTypeDefinition.SIMPLE_TYPE) {
fNSComponents[i][objectType] = new XSNamedMap4Types(namespace, table, objectType);
}
else {
fNSComponents[i][objectType] = new XSNamedMapImpl(namespace, table);
}
}
return fNSComponents[i][objectType];
|
public org.apache.xerces.xs.XSElementDeclaration | getElementDeclaration(java.lang.String name, java.lang.String namespace)Convenience method. Returns a top-level element declaration.
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSElementDeclaration)sg.fGlobalElemDecls.get(name);
|
public org.apache.xerces.xs.XSModelGroupDefinition | getModelGroupDefinition(java.lang.String name, java.lang.String namespace)Convenience method. Returns a top-level model group definition.
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSModelGroupDefinition)sg.fGlobalGroupDecls.get(name);
|
public org.apache.xerces.xs.XSNamespaceItemList | getNamespaceItems()
// REVISIT: should the type of fGrammarList be NSItemListImpl?
return new NSItemListImpl(fGrammarList, fGrammarCount);
|
public org.apache.xerces.xs.StringList | getNamespaces()Convenience method. Returns a list of all namespaces that belong to
this schema.
// REVISIT: should the type of fNamespace be StringListImpl?
return new StringListImpl(fNamespaces, fGrammarCount);
|
public org.apache.xerces.xs.XSNotationDeclaration | getNotationDeclaration(java.lang.String name, java.lang.String namespace)
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSNotationDeclaration)sg.fGlobalNotationDecls.get(name);
|
public org.apache.xerces.xs.XSObjectList | getSubstitutionGroup(org.apache.xerces.xs.XSElementDeclaration head)
return (XSObjectList)fSubGroupMap.get(head);
|
public org.apache.xerces.xs.XSTypeDefinition | getTypeDefinition(java.lang.String name, java.lang.String namespace)Convenience method. Returns a top-level simple or complex type
definition.
SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace));
if (sg == null)
return null;
return (XSTypeDefinition)sg.fGlobalTypeDecls.get(name);
|
public boolean | hasIDConstraints()REVISIT: to expose identity constraints from XSModel.
For now, we only expose whether there are any IDCs.
We also need to add these methods to the public
XSModel interface.
return fHasIDC;
|
private static final java.lang.String | null2EmptyString(java.lang.String str)
return str == null ? XMLSymbols.EMPTY_STRING : str;
|