本文整理汇总了Java中com.sun.org.apache.xerces.internal.xs.XSNamedMap.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java XSNamedMap.getLength方法的具体用法?Java XSNamedMap.getLength怎么用?Java XSNamedMap.getLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.xs.XSNamedMap
的用法示例。
在下文中一共展示了XSNamedMap.getLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}