本文整理汇总了Java中org.apache.xerces.xs.XSObjectList.getLength方法的典型用法代码示例。如果您正苦于以下问题:Java XSObjectList.getLength方法的具体用法?Java XSObjectList.getLength怎么用?Java XSObjectList.getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.xerces.xs.XSObjectList
的用法示例。
在下文中一共展示了XSObjectList.getLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dumpParticle
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private static void dumpParticle(String path, XSParticle particle)
{
XSTerm term = particle.getTerm();
switch (term.getType())
{
case XSConstants.ELEMENT_DECLARATION:
dumpElement(path, (XSElementDeclaration) term);
break;
case XSConstants.MODEL_GROUP:
XSModelGroup model_group = (XSModelGroup) term;
final XSObjectList particles = model_group.getParticles();
for (int ipar = 0; ipar < particles.getLength(); ipar++)
{
dumpParticle(path, (XSParticle) particles.item(ipar));
}
break;
default:
System.err.println(path + " - UNKNOWN");
}
}
示例2: checkBooleanType
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private static boolean checkBooleanType(XSTypeDefinition td) {
if (td.getTypeCategory() != XSTypeDefinition.SIMPLE_TYPE) {
return false;
}
final XSSimpleTypeDefinition st = ((XSSimpleTypeDefinition) td);
final XSObjectList facets = st.getFacets();
for (int i = 0; i < facets.getLength(); i++) {
final XSFacet facet = (XSFacet) facets.item(i);
if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_LENGTH) {
if ("0".equals(facet.getLexicalFacetValue())) {
return true;
}
}
}
return false;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:XSDModelLoader.java
示例3: getSimpleTypesString
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private static String getSimpleTypesString(XSTypeDefinition et) {
StringBuffer typesHierarchy = new StringBuffer();
while (et != null && !"anySimpleType".equals(et.getName()) && !"anyType".equals(et.getName()) && et.getNamespace() != null) {
typesHierarchy.append(et.getNamespace().substring(et.getNamespace().lastIndexOf("/") + 1))
.append(":")
.append(et.getName())
.append(";");
if (et instanceof XSSimpleType) {
XSSimpleType simpleType = (XSSimpleType) et;
if (simpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST
|| simpleType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
XSObjectList list = simpleType.getMemberTypes();
if (list.getLength() > 0) {
typesHierarchy.append("{");
for (int i = 0; i < list.getLength(); i++) {
typesHierarchy.append(getSimpleTypesString((XSTypeDefinition) list.item(i)));
}
typesHierarchy.append("}");
}
}
}
et = et.getBaseType();
}
return typesHierarchy.toString();
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:XSDModelLoader.java
示例4: parseXbrlTaxonomy
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private XbrlTaxonomy parseXbrlTaxonomy(XSElementDeclaration elementDec) throws XbrlException{
//should only contain the synthetic annotation for the attributes
XSObjectList list = elementDec.getAnnotations();
if(list.getLength() != 1)
throw new XbrlException("element with ns: " + elementDec.getNamespace() + " name: " + elementDec.getName() + " has unexpected number of annotations:" + list.getLength());
try{
XSAnnotation attributeObj = (XSAnnotation)list.item(0);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
attributeObj.writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT);
NamedNodeMap attributes = doc.getFirstChild().getAttributes();
XbrlTaxonomy xbrlTaxonomy = new XbrlTaxonomy(elementDec, attributes);
return xbrlTaxonomy;
}
catch(Exception e){
}
return null;
}
示例5: analyzeAttributes
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void analyzeAttributes(IXSDNode currentNode, XSElementDecl currentElementDeclaration) {
XSComplexTypeDefinition complexTypeDefinition = (XSComplexTypeDefinition) currentElementDeclaration.getTypeDefinition();
XSObjectList listOfAttributes = complexTypeDefinition.getAttributeUses();
if (listOfAttributes.getLength() != 0) {
TypeCompositor attList = new TypeCompositor(TypeCompositor.ATTLIST);
for (int i = 0; i < listOfAttributes.getLength(); i++) {
XSAttributeUseImpl xsdAttribute = (XSAttributeUseImpl) listOfAttributes.item(i);
AttributeDeclaration attribute = new AttributeDeclaration(xsdAttribute.getAttrDeclaration().getName());
if (logger.isDebugEnabled()) logger.debug(" --- AttributeName: " + xsdAttribute.getAttrDeclaration().getName() + " type: " + xsdAttribute.getType());
if (xsdAttribute.getRequired()) {
attribute.setMinCardinality(1);
}
int leafType = xsdAttribute.getAttrDeclaration().getTypeDefinition().getBuiltInKind();
attribute.addChild(new SimpleType(getLeafType(leafType)));
attList.addChild(attribute);
}
currentNode.addChild(attList);
}
}
示例6: isDerivedByUnion
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
/**
* Checks if a type is derived from another by union. See:
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
*
* @param ancestorNS
* The namspace of the ancestor type declaration
* @param ancestorName
* The name of the ancestor type declaration
* @param type
* The reference type definition
*
* @return boolean True if the type is derived by union for the reference type
*/
private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) {
// If the variety is union
if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) {
// get member types
XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes();
for (int i = 0; i < memberTypes.getLength(); i++) {
// One of the {member type definitions} is T2.
if (memberTypes.item(i) != null) {
// T2 is derived from the other type definition by DERIVATION_RESTRICTION
if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) {
return true;
}
}
}
}
return false;
}
示例7: containsQName
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private boolean containsQName(XSSimpleType type) {
if (type.getVariety() == XSSimpleType.VARIETY_ATOMIC) {
short primitive = type.getPrimitiveKind();
return (primitive == XSSimpleType.PRIMITIVE_QNAME ||
primitive == XSSimpleType.PRIMITIVE_NOTATION);
}
else if (type.getVariety() == XSSimpleType.VARIETY_LIST) {
return containsQName((XSSimpleType)type.getItemType());
}
else if (type.getVariety() == XSSimpleType.VARIETY_UNION) {
XSObjectList members = type.getMemberTypes();
for (int i = 0; i < members.getLength(); i++) {
if (containsQName((XSSimpleType)members.item(i)))
return true;
}
}
return false;
}
示例8: processPSVIAnnotations
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void processPSVIAnnotations(XSObjectList annotations) {
boolean empty = true;
if (annotations != null && annotations.getLength() > 0) {
for (int i = 0; i < annotations.getLength(); i++) {
if (annotations.item(i) != null) {
empty = false;
break;
}
}
}
if (empty) {
sendElementEvent("psv:annotations");
}
else {
sendIndentedElement("psv:annotations");
for (int i = 0; i < annotations.getLength(); i++) {
processPSVIAnnotation((XSAnnotation)annotations.item(i));
}
sendUnIndentedElement("psv:annotations");
}
}
示例9: processPSVIAttributeUses
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void processPSVIAttributeUses(XSObjectList uses) {
if (uses == null || uses.getLength() == 0) {
sendElementEvent("psv:attributeUses");
}
else {
sendIndentedElement("psv:attributeUses");
for (int i = 0; i < uses.getLength(); i++) {
XSAttributeUse use = (XSAttributeUse)uses.item(i);
sendIndentedElement("psv:attributeUse");
sendElementEvent("psv:required", String.valueOf(use.getRequired()));
processPSVIAttributeDeclarationOrRef(use.getAttrDeclaration());
processPSVIValueConstraint(use.getConstraintType(), use.getConstraintValue());
sendUnIndentedElement("psv:attributeUse");
}
sendUnIndentedElement("psv:attributeUses");
}
}
示例10: collectChildElements
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
protected void collectChildElements(XSParticle particle, Set<String> elementNames) {
if (particle==null) {
log.warn("collectChildElements() particle is null, is this a problem?");
return;
}
XSTerm term = particle.getTerm();
if (term==null) {
throw new IllegalStateException("collectChildElements particle.term is null");
}
if (term instanceof XSModelGroup) {
XSModelGroup modelGroup = (XSModelGroup)term;
XSObjectList particles = modelGroup.getParticles();
for (int i=0;i<particles.getLength();i++) {
XSParticle childParticle = (XSParticle)particles.item(i);
collectChildElements(childParticle, elementNames);
}
return;
}
if (term instanceof XSElementDeclaration) {
XSElementDeclaration elementDeclaration=(XSElementDeclaration)term;
String elementName=elementDeclaration.getName();
if (DEBUG) log.debug("collectChildElements() ElementDeclaration name ["+elementName+"]");
elementNames.add(elementName);
}
return;
}
示例11: findMultipleOccurringChildElements
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
protected Set<String> findMultipleOccurringChildElements(XSParticle particle) {
Set<String> result=new HashSet<String>();
if (particle==null) {
log.warn("findMultipleOccurringChildElements() typeDefinition particle is null, is this a problem?");
return result;
}
XSTerm term = particle.getTerm();
if (term==null) {
throw new IllegalStateException("findMultipleOccurringChildElements particle.term is null");
}
if (DEBUG) log.debug("findMultipleOccurringChildElements() term name ["+term.getName()+"] occurring unbounded ["+particle.getMaxOccursUnbounded()+"] max occur ["+particle.getMaxOccurs()+"] term ["+ToStringBuilder.reflectionToString(term)+"]");
if (particle.getMaxOccursUnbounded()||particle.getMaxOccurs()>1) {
collectChildElements(particle,result);
return result;
}
if (term instanceof XSModelGroup) {
XSModelGroup modelGroup = (XSModelGroup)term;
XSObjectList particles = modelGroup.getParticles();
if (DEBUG) log.debug("findMultipleOccurringChildElements() modelGroup particles ["+ToStringBuilder.reflectionToString(particles)+"]");
for (int i=0;i<particles.getLength();i++) {
XSParticle childParticle = (XSParticle)particles.item(i);
result.addAll(findMultipleOccurringChildElements(childParticle));
}
}
return result;
}
示例12: findReferenceInParticle
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
/**
* Finds all the element and complexType references for a particle element and populates a map entry with element
* names referenced by the element.
*
* @param context the context.
* @param particle the particle.
*/
private void findReferenceInParticle(String context,
XSParticle particle) {
if (null != particle) {
XSTerm term = particle.getTerm();
if (term instanceof XSModelGroup) {
XSObjectList xsObjectList = ((XSModelGroup) term).getParticles();
for (int i = 0; i < xsObjectList.getLength(); i++) {
XSObject xsObject = xsObjectList.item(i);
if (xsObject instanceof XSParticle) {
findReferenceInParticle(context, (XSParticle) xsObject);
}
}
}
else if (term instanceof XSElementDeclaration) {
String tName = term.getName();
addToSchemaMap(context, tName);
context = tName;
if (currentNodeNames.contains(tName)) {
// cyclic reference
currentNodeNames.add(tName);
findElementReference(context, (XSElementDeclaration) term);
}
else {
currentNodeNames.add(tName);
findElementReference(context, (XSElementDeclaration) term);
}
}
// else { // XSWildcard
// String tName = term.getName();
// if (tName != null) {
// addToSchemaTable(aContext, tName);
// }
// }
}
}
示例13: getValidSubTags
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private Map<QName,XSParticle> getValidSubTags(XSElementDeclaration elmt) {
if (!(elmt.getTypeDefinition() instanceof XSComplexTypeDefinition)) {
return HashMap.empty();
}
XSComplexTypeDefinition type = (XSComplexTypeDefinition) elmt.getTypeDefinition();
if (type.getParticle() == null || !(type.getParticle().getTerm() instanceof XSModelGroup)) {
return HashMap.empty();
}
XSModelGroup group = (XSModelGroup) type.getParticle().getTerm();
if (group.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE && group.getCompositor() != XSModelGroup.COMPOSITOR_CHOICE) {
return HashMap.empty();
}
// We don't care whether it's SEQUENCE or CHOICE, we only want to know what are the valid sub-elements at this level.
XSObjectList particles = group.getParticles();
Map<QName,XSParticle> content = HashMap.empty();
for (int j = 0; j < particles.getLength(); j++) {
XSParticle sub = (XSParticle) particles.get(j);
if (sub.getTerm() instanceof XSElementDeclaration) {
XSElementDeclaration term = (XSElementDeclaration) sub.getTerm();
content = content.put(new QName(term.getNamespace(), term.getName()), sub);
}
}
return content;
}
示例14: parseXbrlSchemaAppInfo
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void parseXbrlSchemaAppInfo(XSObjectList annotationList) throws IOException, SAXException{
for(int i = 0; i < annotationList.getLength(); i++){
XSObject object = annotationList.item(i);
//logger.info("annotation: " + ((XSAnnotation)object).getAnnotationString());
((XSAnnotation)object).writeAnnotation(loader, XSAnnotation.SAX_CONTENTHANDLER);
//((XSAnnotation)object).writeAnnotation(doc, XSAnnotation.W3C_DOM_DOCUMENT);
}
}
示例15: analyzeModelGroup
import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void analyzeModelGroup(IXSDNode currentNode, XSParticleDecl fatherParticle, XSModelGroupImpl currentTerm) {
IXSDNode typeCompositor = createTypeCompositor(currentTerm);
setCardinality(typeCompositor, fatherParticle);
currentNode.addChild(typeCompositor);
XSObjectList childrenParticles = currentTerm.getParticles();
if (logger.isDebugEnabled()) logger.debug("Particles size = " + childrenParticles.getLength());
for (int i = 0; i < childrenParticles.getLength(); i++) {
XSObject xsObject = childrenParticles.item(i);
if (logger.isDebugEnabled()) logger.debug("Particle object: " + xsObject);
XSParticleDecl particle = (XSParticleDecl)xsObject;
analyzeParticle(typeCompositor, fatherParticle, particle);
}
checkMixedContent(typeCompositor);
}