当前位置: 首页>>代码示例>>Java>>正文


Java XSObjectList.item方法代码示例

本文整理汇总了Java中org.apache.xerces.xs.XSObjectList.item方法的典型用法代码示例。如果您正苦于以下问题:Java XSObjectList.item方法的具体用法?Java XSObjectList.item怎么用?Java XSObjectList.item使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xerces.xs.XSObjectList的用法示例。


在下文中一共展示了XSObjectList.item方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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;
}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:23,代码来源:XbrlElementHandler.java

示例3: 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);
    }
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:20,代码来源:GenerateXSDNodeTree.java

示例4: 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;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:34,代码来源:XSSimpleTypeDecl.java

示例5: 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");
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:23,代码来源:PSVIWriter.java

示例6: 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");
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:18,代码来源:PSVIWriter.java

示例7: 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;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:27,代码来源:XmlAligner.java

示例8: 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;
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:27,代码来源:XmlAligner.java

示例9: 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);
      // }
      // }
   }
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:43,代码来源:SchemaHelper.java

示例10: 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);
		
	}
}
 
开发者ID:chen4119,项目名称:tempeh,代码行数:11,代码来源:XbrlElementHandler.java

示例11: 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);
}
 
开发者ID:dbunibas,项目名称:spicy,代码行数:15,代码来源:GenerateXSDNodeTree.java

示例12: processParticle

import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private Path processParticle(Path parent, String path, XSParticle xsParticle, Map<String, List<XSElementDeclaration>> substitutions,
		List<XSElementDeclaration> parents) throws BagriException {
	
	if (xsParticle == null) {
		return parent;
	}
	
    XSTerm xsTerm = xsParticle.getTerm();
    
    Path particle = parent;
    switch (xsTerm.getType()) {
      case XSConstants.ELEMENT_DECLARATION:

    	  particle = processElement(parent, path, (XSElementDeclaration) xsTerm, substitutions, parents, xsParticle.getMinOccurs(), xsParticle.getMaxOccurs());
    	  break;

      case XSConstants.MODEL_GROUP:

    	  // this is one of the globally defined groups 
    	  // (found in top-level declarations)

    	  XSModelGroup xsGroup = (XSModelGroup) xsTerm;

	      // it also consists of particles
	      XSObjectList xsParticleList = xsGroup.getParticles();
	      for (int i = 0; i < xsParticleList.getLength(); i ++) {
	    	  XSParticle xsp = (XSParticle) xsParticleList.item(i);
	    	  particle = processParticle(parent, path, xsp, substitutions, parents);
	      }

	      //...
	      break;

      case XSConstants.WILDCARD:

          //...
          break;
    }
    return particle;
}
 
开发者ID:dsukhoroslov,项目名称:bagri,代码行数:41,代码来源:XmlModeler.java

示例13: parseXSObject

import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
/**
 * Parse a schema element and attach the result to the given node.
 * 
 * @param schemaElem the schema element.
 * @param nodeContext the Node where the xml instance is generated.
 * @return the generated DOM node.
 */
protected Node parseXSObject(XSObject schemaElem,
                             Node nodeContext) throws Exception {
   Element contentElem = null;
   if (!(schemaElem instanceof XSSimpleTypeDefinition)) {
      // create the element
      contentElem = DocumentHelper.createElement(generatedDoc, schemaElem.getNamespace(), schemaElem.getName());
   }
   XSTypeDefinition tDefinition = null;
   if (schemaElem instanceof XSElementDeclaration) {
      tDefinition = ((XSElementDeclaration) schemaElem).getTypeDefinition();
      nodeContext.appendChild(contentElem);
   }
   else if (schemaElem instanceof XSTypeDefinition) {
      tDefinition = ((XSTypeDefinition) schemaElem);
   }
   else {
      tDefinition = ((XSTypeDefinition) schemaElem);
   }

   if (tDefinition instanceof XSComplexTypeDefinition) {
      XSComplexTypeDefinition ctDef = (XSComplexTypeDefinition) tDefinition;

      XSObjectList attList = ctDef.getAttributeUses();
      for (int i = 0; i < attList.getLength(); i++) {
         XSAttributeUse attrUseObject = (XSAttributeUse) attList.item(i);
         String attribname = attrUseObject.getAttrDeclaration().getName();
         if (sampleXML) {
            parseXSObject(attrUseObject.getAttrDeclaration().getTypeDefinition(),
                          DocumentHelper.createElement(generatedDoc, null, attribname));
         }
         assignAttributeValue(attribname, contentElem);
      }

      XSParticle particle = ((XSComplexTypeDefinition) tDefinition).getParticle();

      String typeDefName = tDefinition.getName();
      if (null != typeDefName) {
         processXSParticle(particle, contentElem);
      }
      else {
         processXSParticle(particle, contentElem);
      }
   }
   else {
      if (sampleXML) {
         StringList enumeration = ((XSSimpleTypeDefinition) tDefinition).getLexicalEnumeration();
         if (0 < enumeration.getLength()) {
            String name;
            if (null == nodeContext.getParentNode()) {
               name = "'" + nodeContext.getNodeName() + "' attribute";
            }
            else {
               name = "'" + schemaElem.getName() + "' node";
            }
            ArrayList<String> enumList = enumerationMap.get(name);
            if (null == enumList) {
               enumList = new ArrayList<String>();
               enumerationMap.put(name, enumList);
            }
            for (int i = 0; i < enumeration.getLength(); i++) {
               enumList.add(enumeration.item(i));
            }
         }
      }
   }
   if (!(schemaElem instanceof XSSimpleTypeDefinition)) {
      assignNodeValue(contentElem);
   }
   return contentElem;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:78,代码来源:SchemaLoader.java

示例14: mergeAttributes

import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
private void mergeAttributes(XSAttributeGroupDecl fromAttrGrp,
        XSAttributeGroupDecl toAttrGrp,
        String typeName,
        boolean extension,
        Element elem)
throws ComplexTypeRecoverableError {
    
    XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
    XSAttributeUseImpl oneAttrUse = null;
    int attrCount = attrUseS.getLength();
    for (int i=0; i<attrCount; i++) {
        oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
        XSAttributeUse existingAttrUse = toAttrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
                oneAttrUse.fAttrDecl.getName());
        if (existingAttrUse == null) {
            
            String idName = toAttrGrp.addAttributeUse(oneAttrUse);
            if (idName != null) {
                throw new ComplexTypeRecoverableError("ct-props-correct.5",
                        new Object[]{typeName, idName, oneAttrUse.fAttrDecl.getName()},
                        elem);
            }
        }
        else if (existingAttrUse != oneAttrUse) {
            if (extension) {
                reportSchemaError("ct-props-correct.4",
                        new Object[]{typeName, oneAttrUse.fAttrDecl.getName()},
                        elem);
                // Recover by using the attribute use from the base type,
                // to make the resulting schema "more valid".
                toAttrGrp.replaceAttributeUse(existingAttrUse, oneAttrUse);
            }
        }
    }
    // For extension, the wildcard must be formed by doing a union of the wildcards
    if (extension) {
        if (toAttrGrp.fAttributeWC==null) {
            toAttrGrp.fAttributeWC = fromAttrGrp.fAttributeWC;
        }
        else if (fromAttrGrp.fAttributeWC != null) {
            toAttrGrp.fAttributeWC = toAttrGrp.fAttributeWC.performUnionWith(fromAttrGrp.fAttributeWC, toAttrGrp.fAttributeWC.fProcessContents);
            if (toAttrGrp.fAttributeWC == null) {
                // REVISIT: XML Schema 1.0 2nd edition doesn't actually specify this constraint. It's a bug in the spec
                // which will eventually be fixed. We're just guessing what the error code will be. If it turns out to be
                // something else we'll need to change it. -- mrglavas
                throw new ComplexTypeRecoverableError("src-ct.5", new Object[]{typeName}, elem);
            }
        }
        
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:52,代码来源:XSDComplexTypeTraverser.java

示例15: startElement

import org.apache.xerces.xs.XSObjectList; //导入方法依赖的package包/类
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
	boolean xmlArrayContainer=aligner.isParentOfSingleMultipleOccurringChildElement();
	boolean repeatedElement=aligner.isMultipleOccurringChildInParentElement(localName);
	XSTypeDefinition typeDefinition=aligner.getTypeDefinition();
	if (!localName.equals(topElement)) {
		if (topElement!=null) {
			if (DEBUG) log.debug("endElementGroup ["+topElement+"]");
			documentContainer.endElementGroup(topElement);	
		}
		if (DEBUG) log.debug("startElementGroup ["+localName+"]");
		documentContainer.startElementGroup(localName, xmlArrayContainer, repeatedElement, typeDefinition);	
		topElement=localName;			
	}
	element.push(topElement);
	topElement=null;
	if (DEBUG) log.debug("startElement ["+localName+"] xml array container ["+aligner.isParentOfSingleMultipleOccurringChildElement()+"] repeated element ["+aligner.isMultipleOccurringChildInParentElement(localName)+"]");
	documentContainer.startElement(localName,xmlArrayContainer,repeatedElement, typeDefinition);
	super.startElement(uri, localName, qName, atts);
	if (aligner.isNil(atts)) {
		documentContainer.setNull();
	} else {
		if (writeAttributes) {
			XSObjectList attributeUses=aligner.getAttributeUses();
			if (attributeUses==null) {
				if (atts.getLength()>0) {
					log.warn("found ["+atts.getLength()+"] attributes, but no declared AttributeUses");
				}
			} else {
				for (int i=0;i<attributeUses.getLength(); i++) {
					XSAttributeUse attributeUse=(XSAttributeUse)attributeUses.item(i);
					XSAttributeDeclaration attributeDeclaration=attributeUse.getAttrDeclaration();
					XSSimpleTypeDefinition attTypeDefinition=attributeDeclaration.getTypeDefinition();
					String attName=attributeDeclaration.getName();
					String attNS=attributeDeclaration.getNamespace();
					if (DEBUG) log.debug("startElement ["+localName+"] searching attribute ["+attNS+":"+attName+"]");
					int attIndex=attNS!=null? atts.getIndex(attNS, attName):atts.getIndex(attName);
					if (attIndex>=0) {
						String value=atts.getValue(attIndex);
						if (DEBUG) log.debug("startElement ["+localName+"] attribute ["+attNS+":"+attName+"] value ["+value+"]");
						if (StringUtils.isNotEmpty(value)) {
							documentContainer.setAttribute(attName, value, attTypeDefinition);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:50,代码来源:XmlTo.java


注:本文中的org.apache.xerces.xs.XSObjectList.item方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。