本文整理汇总了Java中com.sun.org.apache.xerces.internal.xs.XSNamedMap类的典型用法代码示例。如果您正苦于以下问题:Java XSNamedMap类的具体用法?Java XSNamedMap怎么用?Java XSNamedMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSNamedMap类属于com.sun.org.apache.xerces.internal.xs包,在下文中一共展示了XSNamedMap类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSubGroups_Org
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
private SymbolHash buildSubGroups_Org() {
SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
for (int i = 0 ; i < fGrammarCount; i++) {
sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
}
final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION);
final int len = elements.getLength();
final SymbolHash subGroupMap = new SymbolHash(len*2);
XSElementDecl head;
XSElementDeclaration[] subGroup;
for (int i = 0; i < len; i++) {
head = (XSElementDecl)elements.item(i);
subGroup = sgHandler.getSubstitutionGroup(head);
subGroupMap.put(head, subGroup.length > 0 ?
new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
}
return subGroupMap;
}
示例2: addGlobalTypeDecls
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
private void addGlobalTypeDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
XSNamedMap components = srcGrammar.getComponents(XSConstants.TYPE_DEFINITION);
int len = components.getLength();
XSTypeDefinition srcDecl, dstDecl;
// add global components
for (int i=0; i<len; i++) {
srcDecl = (XSTypeDefinition) components.item(i);
dstDecl = dstGrammar.getGlobalTypeDecl(srcDecl.getName());
if (dstDecl == null) {
dstGrammar.addGlobalTypeDecl(srcDecl);
}
else if (dstDecl != srcDecl && !fTolerateDuplicates) {
reportSharingError(srcDecl.getNamespace(), srcDecl.getName());
}
}
// add any extended (duplicate) global components
ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.TYPE_DEFINITION);
len = componentsExt.getLength();
for (int i=0; i<len; i+= 2) {
final String key = (String) componentsExt.item(i);
final int index = key.indexOf(',');
final String location = key.substring(0, index);
final String name = key.substring(index + 1, key.length());
srcDecl = (XSTypeDefinition)componentsExt.item(i+1);
dstDecl = dstGrammar.getGlobalTypeDecl(name, location);
if (dstDecl == null) {
dstGrammar.addGlobalTypeDecl(srcDecl, location);
}
// REVISIT - do we report an error?
else if (dstDecl != srcDecl) {
}
}
}
示例3: getComponents
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* [schema components]: a list of top-level components, i.e. element
* declarations, attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definition of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
if (fComponents == null)
fComponents = new XSNamedMap[MAX_COMP_IDX+1];
// get the hashtable for this type of components
if (fComponents[objectType] == null) {
SymbolHash table = null;
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
table = fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
table = fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
table = fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
table = fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
table = fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
table = 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) {
fComponents[objectType] = new XSNamedMap4Types(fTargetNamespace, table, objectType);
}
else {
fComponents[objectType] = new XSNamedMapImpl(fTargetNamespace, table);
}
}
return fComponents[objectType];
}
示例4: XSModelImpl
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) {
// copy namespaces/grammars from the array to our arrays
int len = grammars.length;
final int initialSize = Math.max(len+1, 5);
String[] namespaces = new String[initialSize];
SchemaGrammar[] grammarList = new SchemaGrammar[initialSize];
boolean hasS4S = false;
for (int i = 0; i < len; i++) {
final SchemaGrammar sg = grammars[i];
final String tns = sg.getTargetNamespace();
namespaces[i] = tns;
grammarList[i] = sg;
if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) {
hasS4S = true;
}
}
// If a schema for the schema namespace isn't included, include it here.
if (!hasS4S) {
namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA;
grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion);
}
SchemaGrammar sg1, sg2;
Vector gs;
int i, j, k;
// and recursively get all imported grammars, add them to our arrays
for (i = 0; i < len; i++) {
// get the grammar
sg1 = grammarList[i];
gs = sg1.getImportedGrammars();
// for each imported grammar
for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) {
sg2 = (SchemaGrammar)gs.elementAt(j);
// check whether this grammar is already in the list
for (k = 0; k < len; k++) {
if (sg2 == grammarList[k]) {
break;
}
}
// if it's not, add it to the list
if (k == len) {
// ensure the capacity of the arrays
if (len == grammarList.length) {
String[] newSA = new String[len*2];
System.arraycopy(namespaces, 0, newSA, 0, len);
namespaces = newSA;
SchemaGrammar[] newGA = new SchemaGrammar[len*2];
System.arraycopy(grammarList, 0, newGA, 0, len);
grammarList = newGA;
}
namespaces[len] = sg2.getTargetNamespace();
grammarList[len] = sg2;
len++;
}
}
}
fNamespaces = namespaces;
fGrammarList = grammarList;
boolean hasIDC = false;
// establish the mapping from namespace to grammars
fGrammarMap = new SymbolHash(len*2);
for (i = 0; i < len; i++) {
fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]);
// update the idc field
if (fGrammarList[i].hasIDConstraints()) {
hasIDC = true;
}
}
fHasIDC = hasIDC;
fGrammarCount = len;
fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1];
fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1];
fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount);
// build substitution groups
fSubGroupMap = buildSubGroups();
}
示例5: getComponents
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* Returns a list of top-level components, i.e. element declarations,
* attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definitions of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
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];
}
示例6: getComponentsByNamespace
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* Convenience method. Returns a list of top-level component declarations
* that are defined within the specified namespace, i.e. element
* declarations, attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>.
* @param namespace The namespace to which the declaration belongs or
* <code>null</code> (for components with no target namespace).
* @return A list of top-level definitions of the specified type in
* <code>objectType</code> and defined in the specified
* <code>namespace</code> or an empty <code>XSNamedMap</code>.
*/
public synchronized XSNamedMap getComponentsByNamespace(short objectType,
String namespace) {
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];
}
示例7: getIdentityConstraints
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* {identity-constraint definitions} A set of constraint definitions.
*/
public XSNamedMap getIdentityConstraints() {
return new XSNamedMapImpl(fIDConstraints, fIDCPos);
}
示例8: getComponents
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* [schema components]: a list of top-level components, i.e. element
* declarations, attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definition of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
if (objectType <= 0 || objectType > MAX_COMP_IDX ||
!GLOBAL_COMP[objectType]) {
return XSNamedMapImpl.EMPTY_MAP;
}
if (fComponents == null)
fComponents = new XSNamedMap[MAX_COMP_IDX+1];
// get the hashtable for this type of components
if (fComponents[objectType] == null) {
SymbolHash table = null;
switch (objectType) {
case XSConstants.TYPE_DEFINITION:
case XSTypeDefinition.COMPLEX_TYPE:
case XSTypeDefinition.SIMPLE_TYPE:
table = fGlobalTypeDecls;
break;
case XSConstants.ATTRIBUTE_DECLARATION:
table = fGlobalAttrDecls;
break;
case XSConstants.ELEMENT_DECLARATION:
table = fGlobalElemDecls;
break;
case XSConstants.ATTRIBUTE_GROUP:
table = fGlobalAttrGrpDecls;
break;
case XSConstants.MODEL_GROUP_DEFINITION:
table = fGlobalGroupDecls;
break;
case XSConstants.NOTATION_DECLARATION:
table = fGlobalNotationDecls;
break;
case XSConstants.IDENTITY_CONSTRAINT:
table = this.fGlobalIDConstraintDecls;
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) {
fComponents[objectType] = new XSNamedMap4Types(fTargetNamespace, table, objectType);
}
else {
fComponents[objectType] = new XSNamedMapImpl(fTargetNamespace, table);
}
}
return fComponents[objectType];
}
示例9: getComponents
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* Returns a list of top-level components, i.e. element declarations,
* attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>. Note that
* <code>XSTypeDefinition.SIMPLE_TYPE</code> and
* <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
* <code>objectType</code> to retrieve only complex types or simple
* types, instead of all types.
* @return A list of top-level definitions of the specified type in
* <code>objectType</code> or an empty <code>XSNamedMap</code> if no
* such definitions exist.
*/
public synchronized XSNamedMap getComponents(short objectType) {
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;
case XSConstants.IDENTITY_CONSTRAINT:
tables[i] = fGrammarList[i].fGlobalIDConstraintDecls;
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];
}
示例10: getComponentsByNamespace
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
/**
* Convenience method. Returns a list of top-level component declarations
* that are defined within the specified namespace, i.e. element
* declarations, attribute declarations, etc.
* @param objectType The type of the declaration, i.e.
* <code>ELEMENT_DECLARATION</code>.
* @param namespace The namespace to which the declaration belongs or
* <code>null</code> (for components with no target namespace).
* @return A list of top-level definitions of the specified type in
* <code>objectType</code> and defined in the specified
* <code>namespace</code> or an empty <code>XSNamedMap</code>.
*/
public synchronized XSNamedMap getComponentsByNamespace(short objectType,
String namespace) {
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;
case XSConstants.IDENTITY_CONSTRAINT:
table = fGrammarList[i].fGlobalIDConstraintDecls;
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];
}
示例11: apply
import com.sun.org.apache.xerces.internal.xs.XSNamedMap; //导入依赖的package包/类
public JSRoot apply(final String rootName) throws SAXException {
Preconditions.checkState(model != null, "You have to call parse() first");
//final XSSchemaSet result = parser.getResult();
//final Iterator<XSSchema> xsSchemaIterator = result.iterateSchema();
final JSRoot root = new JSRoot(rootName);
//while (xsSchemaIterator.hasNext()) {
//final XSSchema xsSchema = xsSchemaIterator.next();
final XSNamedMap elements = model.getComponents(XSConstants.ELEMENT_DECLARATION);
for (int i = 0; i < elements.getLength(); i++) {
final XSObject object = elements.item(i);
if (object instanceof XSElementDeclaration) {
final XSElementDeclaration elementDecl = (XSElementDeclaration) object;
if (elementDecl.getAbstract()) {
// skip abstract elements for now (however, we should treat them separately somehow)
continue;
}
iterateElement(elementDecl).ifPresent(root::add);
}
}
//
// final Set<SchemaDocument> docs = parser.getDocuments();
//
// XSSchema xsSchema = null;
//
// for (final SchemaDocument doc : docs) {
//
// if ("http://purl.org/dc/terms/".equals(doc.getSchema().getTargetNamespace())) {
//
// xsSchema = doc.getSchema();
//
// break;
// }
// }
//
// final Iterator<XSElementDecl> xsElementDeclIterator = xsSchema.iterateElementDecls();
// //final Map<String, XSElementDecl> xsElementDeclMap = xsSchema.getElementDecls();
//
// while (xsElementDeclIterator.hasNext()) {
// //for(final XSElementDecl elementDecl : xsElementDeclMap.values()) {
//
// final XSElementDecl elementDecl = xsElementDeclIterator.next();
//
// if (elementDecl.isAbstract()) {
//
// // skip abstract elements for now (however, we should treat them separately somehow)
//
// continue;
// }
//
// final Optional<JSElement> optionalElement = iterateElement(elementDecl);
//
// if (optionalElement.isPresent()) {
//
// root.add(optionalElement.get());
// }
//}
//}
//}
return root;
}