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


Java XSParticle类代码示例

本文整理汇总了Java中org.apache.xerces.xs.XSParticle的典型用法代码示例。如果您正苦于以下问题:Java XSParticle类的具体用法?Java XSParticle怎么用?Java XSParticle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: dumpParticle

import org.apache.xerces.xs.XSParticle; //导入依赖的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");
   }

}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:24,代码来源:SentinelXsdDumpMetadata.java

示例2: findReference

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
/**
 * Finds all the element and complexType references for the specified root element and populates a map entry with
 * element names referenced by the element.
 * 
 * @param elementDeclaration XSElementDeclaration : the root element
 */
private void findReference(XSElementDeclaration elementDeclaration) {
   String elemName = elementDeclaration.getName();
   String thisContext = elemName;
   XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
   if (null != typeDefinition) {
      String typeDefName = typeDefinition.getName();
      currentNodeNames.clear();
      currentNodeNames.add(elementDeclaration.getName());
      if (typeDefinition instanceof XSComplexTypeDefinition) {
         addToSchemaMap(elemName, typeDefName);
         if (null != typeDefName) {
            thisContext = typeDefName;
         }
         XSParticle particle = ((XSComplexTypeDefinition) typeDefinition).getParticle();
         findReferenceInParticle(thisContext, particle);
      }
      else {
         addToSchemaMap(elemName, typeDefName);
         if (null != typeDefName) {
            thisContext = typeDefName;
         }
      }
   }
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:31,代码来源:SchemaHelper.java

示例3: getOccurances

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
/**
 * Gets the number of occurrences for a particular node based on the XSParticle reference in the schema.
 * 
 * @param particle the particle reference.
 * @param parentElem the parent element.
 * @return the actual no of calculated occurrences.
 */
public int getOccurances(XSParticle particle,
                        Element parentElem) {
   if (null != particle && null != parentElem) {
      int minOccurs = particle.getMinOccurs();
      int maxOccurs = particle.getMaxOccurs();
      
      String particleName = particle.getTerm().getName();
      
      if (choiceListContains(particleName, parentElem)) {
         int numOfSetValues = this.numberOfSetValues(particleName, parentElem);
         return Math.max(1, numOfSetValues);
      }
      else if (0 == minOccurs) {
         return 0;
      }
      else if (minOccurs >= maxOccurs) {
         return minOccurs;
      }
   }
   return DEFAULT_MAX_OCCURS;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:29,代码来源:SchemaLoader.java

示例4: appendCardinality

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
private void appendCardinality(Path path){
    path = path.getParentPath(XSParticle.class);
    if(path!=null){
        XSParticle particle = (XSParticle)path.getElement();
        if(particle.getMinOccurs()==1 && particle.getMaxOccurs()==1)
            return;
        if(particle.getMinOccurs()==0 && particle.getMaxOccurs()==1)
            buff.append("?");
        else if(particle.getMinOccurs()==0 && particle.getMaxOccursUnbounded())
            buff.append("*");
        else if(particle.getMinOccurs()==1 && particle.getMaxOccursUnbounded())
            buff.append("+");
        else{
            buff.append("[");
            if(particle.getMaxOccursUnbounded())
                buff.append(particle.getMinOccurs()).append("+");
            else if(particle.getMinOccurs()==particle.getMaxOccurs())
                buff.append(particle.getMinOccurs());
            else
                buff.append(particle.getMinOccurs()).append(",").append(particle.getMaxOccurs());
            buff.append("]");
        }
    }
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:25,代码来源:XSContentModel.java

示例5: getParticle

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
public XSParticle getParticle() {
    // the wildcard used in anyType (content and attribute)
    // the spec will change strict to skip for anyType
    XSWildcardDecl wildcard = new XSWildcardDecl();
    wildcard.fProcessContents = XSWildcardDecl.PC_LAX;
    // the particle for the content wildcard
    XSParticleDecl particleW = new XSParticleDecl();
    particleW.fMinOccurs = 0;
    particleW.fMaxOccurs = SchemaSymbols.OCCURRENCE_UNBOUNDED;
    particleW.fType = XSParticleDecl.PARTICLE_WILDCARD;
    particleW.fValue = wildcard;
    // the model group of a sequence of the above particle
    XSModelGroupImpl group = new XSModelGroupImpl();
    group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
    group.fParticleCount = 1;
    group.fParticles = new XSParticleDecl[1];
    group.fParticles[0] = particleW;
    // the content of anyType: particle of the above model group
    XSParticleDecl particleG = new XSParticleDecl();
    particleG.fType = XSParticleDecl.PARTICLE_MODELGROUP;
    particleG.fValue = group;

    return particleG;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:25,代码来源:SchemaGrammar.java

示例6: collectChildElements

import org.apache.xerces.xs.XSParticle; //导入依赖的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

示例7: findMultipleOccurringChildElements

import org.apache.xerces.xs.XSParticle; //导入依赖的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

示例8: findElementReference

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
/**
 * Finds all the element and complexType references for the specified element and populates a map entry with element
 * names referenced by the element.
 * 
 * @param context the context.
 * @param elementDeclaration the element declaration.
 */
private void findElementReference(String context,
                                  XSElementDeclaration elementDeclaration) {
   XSTypeDefinition typeDefinition = elementDeclaration.getTypeDefinition();
   if (null != typeDefinition) {
      String typeDefName = typeDefinition.getName();
      if (typeDefinition instanceof XSComplexTypeDefinition) {
         addToSchemaMap(context, typeDefName);
         if (null != typeDefName) {
            context = typeDefName;
         }
         XSParticle particle = ((XSComplexTypeDefinition) typeDefinition).getParticle();
         if (currentNodeNames.contains(typeDefName)) {
            /* circular reference */
            // currentNodeNames.add(typeDefName);
            // findReferenceInParticle(context, particle);
         }
         else {
            currentNodeNames.add(typeDefName);
            findReferenceInParticle(context, particle);
         }
      }
      else {
         addToSchemaMap(context, typeDefName);
         if (null != typeDefName) {
            context = typeDefName;
         }
         currentNodeNames.add(typeDefName);
      }
   }
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:38,代码来源:SchemaHelper.java

示例9: findReferenceInParticle

import org.apache.xerces.xs.XSParticle; //导入依赖的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: getParticleName

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
public String getParticleName(XSParticle particle){
 String itemName = particle.toString();
 if (itemName.contains("{")){
  itemName = itemName.substring(0,itemName.indexOf("{"));
 }
 return itemName;
}
 
开发者ID:mqsysadmin,项目名称:dpdirect,代码行数:8,代码来源:SchemaLoader.java

示例11: getValidSubTags

import org.apache.xerces.xs.XSParticle; //导入依赖的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;
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:28,代码来源:XMLToJSON.java

示例12: processParticle

import org.apache.xerces.xs.XSParticle; //导入依赖的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: expandRelatedComplexTypeComponents

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
private void expandRelatedComplexTypeComponents(XSComplexTypeDecl type, Vector componentList, String namespace, Hashtable dependencies) {
    addRelatedType(type.getBaseType(), componentList, namespace, dependencies);
    expandRelatedAttributeUsesComponents(type.getAttributeUses(), componentList, namespace, dependencies);
    final XSParticle particle = type.getParticle();
    if (particle != null) {
        expandRelatedParticleComponents(particle, componentList, namespace, dependencies);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:9,代码来源:XSDHandler.java

示例14: expandRelatedParticleComponents

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
private void expandRelatedParticleComponents(XSParticle component, Vector componentList,
        String namespace, Hashtable dependencies) {
    XSTerm term = component.getTerm();
    switch (term.getType()) {
    case XSConstants.ELEMENT_DECLARATION :
        addRelatedElement((XSElementDeclaration) term, componentList, namespace, dependencies);
        break;
    case XSConstants.MODEL_GROUP :
        expandRelatedModelGroupComponents((XSModelGroup) term, componentList, namespace, dependencies);
        break;
    default:
        break;
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:15,代码来源:XSDHandler.java

示例15: expandRelatedModelGroupComponents

import org.apache.xerces.xs.XSParticle; //导入依赖的package包/类
private void expandRelatedModelGroupComponents(XSModelGroup modelGroup, Vector componentList,
        String namespace, Hashtable dependencies) {
    XSObjectList particles = modelGroup.getParticles();
    final int length = (particles == null) ? 0 : particles.getLength();
    for (int i=0; i<length; i++) {
        expandRelatedParticleComponents((XSParticle)particles.item(i), componentList, namespace, dependencies);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:9,代码来源:XSDHandler.java


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