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


Java XSParticle.getMaxOccursUnbounded方法代码示例

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


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

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

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

示例3: isMultiValued

import org.apache.xerces.xs.XSParticle; //导入方法依赖的package包/类
private boolean isMultiValued(XSParticle particle) {
    return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1;
}
 
开发者ID:Tradeshift,项目名称:ts-reaktive,代码行数:4,代码来源:XMLToJSON.java

示例4: process

import org.apache.xerces.xs.XSParticle; //导入方法依赖的package包/类
protected boolean process(XSParticle particle){
    return !(!particle.getMaxOccursUnbounded() && particle.getMinOccurs() == 1 && particle.getMaxOccurs() == 1);
}
 
开发者ID:santhosh-tekuri,项目名称:jlibs,代码行数:4,代码来源:XSDisplayFilter.java

示例5: isElementMultiWithin

import org.apache.xerces.xs.XSParticle; //导入方法依赖的package包/类
/**
 * Test if the given element may appear multipe times within the given
 * particle.
 *
 * @param xiDecl the declaration to search for
 * @param xiMulti does the particle itself already occur multiple times?
 * @param xiParticle the particle to search within
 * @return true if it may appear multiple times, false if it may appear at
 * most once, null if the element is not found within the particle.
 */
private static Boolean isElementMultiWithin(XSElementDeclaration xiDecl,
                                            boolean xiMulti,
                                            XSParticle xiParticle)
{
  if (xiParticle == null)
  {
    return null;
  }

  // Determine context multiplicity: either we're already multiple, or this
  // particle can appear multiple times.
  boolean lOuter =
      xiMulti ||
      xiParticle.getMaxOccursUnbounded() ||
      (xiParticle.getMaxOccurs() > 1);

  Boolean lMulti;
  XSTerm lTerm = xiParticle.getTerm();

  if (lTerm instanceof XSModelGroup)
  {
    XSModelGroup lGroup = (XSModelGroup)lTerm;
    XSObjectList lParticles = ((XSModelGroup)lTerm).getParticles();
    lMulti = null;

    for (Object lParticleObj : lParticles)
    {
      XSParticle lParticle = (XSParticle)lParticleObj;

      Boolean lSub = isElementMultiWithin(xiDecl, lOuter, lParticle);

      if (lSub != null)
      {
        if (lMulti == null)
        {
          // Normal case: we've found a single match
          lMulti = lSub;
        }
        else
        {
          // Multiple matches for the element - that's not very sane
          // (although we could just do lMulti = true).
          throw new RuntimeException("Multiple separate occurrences of the same element: " + xiDecl.getName());
        }
      }
    }
  }
  else if (lTerm instanceof XSElementDeclaration)
  {
    XSElementDeclaration lElementDecl = (XSElementDeclaration)lTerm;

    if (isEqualName(lElementDecl, xiDecl))
    {
      // We have a match! Take the multiplicity we've determined for this
      // context.
      lMulti = lOuter;
    }
    else
    {
      lMulti = null;
    }
  }
  else
  {
    throw new RuntimeException("Wildcard or other particle (complex type component) not supported: " + xiDecl.getName());
  }

  return lMulti;
}
 
开发者ID:kw217,项目名称:sax2j,代码行数:80,代码来源:Translator.java


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