Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSParticle


         {
            buf.append((isSimple) ? "<simpleContent>" : "<complexContent>");
            buf.append("<extension base='" + baseType + "'>");
         }

         XSParticle xsp = jxstype.getParticle();
         if (xsp != null)
            appendComplexTypeDefinition(buf, jxstype);

         XSObjectList list = jxstype.getAttributeUses();
         for (int i = 0; i < list.getLength(); i++)
View Full Code Here


      } //end for
   }

   private void appendComplexTypeDefinition(StringBuilder buf, XSComplexTypeDefinition jxstype)
   {
      XSParticle xsp = jxstype.getParticle();
      XSTerm xsterm = xsp.getTerm();
      short deriveMethod = jxstype.getDerivationMethod();

      if (xsterm instanceof XSElementDeclaration)
      {
         // FIXME This is horribly wrong, but too much depends on this broken behavior
         buf.append("<sequence>");

         XSElementDeclaration xsel = (XSElementDeclaration)xsterm;
         buf.append(this.write(xsel, xsp));
         buf.append("</sequence>");
      }
      else if (xsterm instanceof XSModelGroup)
      {
         XSModelGroup jmg = (XSModelGroup)xsterm;
         XSObjectList objlist = jmg.getParticles();
         String end = null;

         switch (jmg.getCompositor())
         {
            case XSModelGroup.COMPOSITOR_ALL:
               buf.append("<all>");
               end = "</all>";
               break;
            case XSModelGroup.COMPOSITOR_CHOICE:
               buf.append("<choice>");
               end = "</choice>";
               break;
            default:
            case XSModelGroup.COMPOSITOR_SEQUENCE:
               buf.append("<sequence>");
               end = "</sequence>";
               break;
         }

         int lenobj = objlist != null ? objlist.getLength() : 0;

         for (int i = 0; i < lenobj; i++)
         {
            XSParticle jxsp = (XSParticle)objlist.item(i);
            XSTerm xterm = jxsp.getTerm();
            if (xterm instanceof XSElementDeclaration)
            {
               XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm();
               buf.append(this.write(xsel, jxsp));
            }
            else if (xterm instanceof XSModelGroup)
            {
               if (deriveMethod == XSConstants.DERIVATION_EXTENSION && i != lenobj - 1)
                  continue;

               if (i == 0)
                  continue;//Ignore as it provides the baseclass sequence of elements
               XSObjectList olist = ((XSModelGroup)xterm).getParticles();
               int lobj = olist != null ? olist.getLength() : 0;
               for (int k = 0; k < lobj; k++)
               {
                  XSParticle jxp = (XSParticle)olist.item(k);
                  XSTerm jxpterm = jxp.getTerm();
                  short termType = jxpterm.getType();
                  if (termType == XSConstants.ELEMENT_DECLARATION)
                     buf.append(write((XSElementDeclaration)jxpterm, jxsp));
                  else if (termType == XSConstants.MODEL_GROUP)
                     buf.append(write((XSModelGroup)jxpterm));
View Full Code Here

            fElementTraverser.traverseLocal (fParticle[i], currElem, currSchema, currGrammar, fAllContext[i], fParent[i], fLocalElemNamespaceContext[i]);
            // If it's an empty particle, remove it from the containing component.
            if (fParticle[i].fType == XSParticleDecl.PARTICLE_EMPTY) {
                XSModelGroupImpl group = null;
                if (fParent[i] instanceof XSComplexTypeDecl) {
                    XSParticle p = ((XSComplexTypeDecl)fParent[i]).getParticle();
                    if (p != null)
                        group = (XSModelGroupImpl)p.getTerm();
                }
                else {
                    group = ((XSGroupDecl)fParent[i]).fModelGroup;
                }
                if (group != null)
View Full Code Here

    }

    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);
        }
    }
View Full Code Here

            fElementTraverser.traverseLocal (fParticle[i], currElem, currSchema, currGrammar, fAllContext[i], fParent[i], fLocalElemNamespaceContext[i]);
            // If it's an empty particle, remove it from the containing component.
            if (fParticle[i].fType == XSParticleDecl.PARTICLE_EMPTY) {
                XSModelGroupImpl group = null;
                if (fParent[i] instanceof XSComplexTypeDecl) {
                    XSParticle p = ((XSComplexTypeDecl)fParent[i]).getParticle();
                    if (p != null)
                        group = (XSModelGroupImpl)p.getTerm();
                }
                else {
                    group = ((XSGroupDecl)fParent[i]).fModelGroup;
                }
                if (group != null)
View Full Code Here

    }
    tagList.add(tagInfo);

    XSTypeDefinition type = element.getTypeDefinition();
    if (type instanceof XSComplexTypeDefinition) {
      XSParticle particle = ((XSComplexTypeDefinition) type).getParticle();
      if (particle != null) {
        XSTerm term = particle.getTerm();
        if (term instanceof XSElementDeclaration) {
          parseXSDElement(tagList, (XSElementDeclaration) term);
          tagInfo.addChildTagName(((XSElementDeclaration) term).getName());
        }
        if (term instanceof XSModelGroup) {
View Full Code Here

      {
         parentPart.setAggregation(nAggregation);
         aggregation = new Byte(nAggregation);
      }

      XSParticle newModelGroupParticles[] = new XSParticle[modelGroupParticles.length + 1];

      System.arraycopy(modelGroupParticles, 0, newModelGroupParticles, 0, modelGroupParticles.length);
      newModelGroupParticles[modelGroupParticles.length] = modelParticle;
     
      for (int i = 0; i < particleList.getLength(); ++i)
      {
         XSParticle childParticle = (XSParticle)particleList.item(i);

         if (!contains(getParticleList(baseType), childParticle))
         {
            addChildParts(parentPart, newModelGroupParticles, childParticle, baseType, aggregation);
         }
View Full Code Here

  
   protected static XSObjectList getParticleList(XSComplexTypeDefinition type)
   {
      if (type != null)
      {
         XSParticle particle = XSDUtil.getParticle(type);
  
         if (particle != null)
         {
            XSTerm term = particle.getTerm();
           
            if (term.getType() == XSConstants.MODEL_GROUP)
            {
               return ((XSModelGroup)term).getParticles();
            }
View Full Code Here

      }
      finally
      {
         if (modelGroupParticles.length > 0)
         {
            XSParticle intermediateParticle = modelGroupParticles[0];

            assert intermediateParticle.getTerm() instanceof XSModelGroup;
           
            int nMinOccurs = getMinOccurs(modelGroupParticles, 0, intermediateParticle.getMinOccurs(), part);
            int nMaxOccurs = intermediateParticle.getMaxOccursUnbounded() ? 0 : intermediateParticle.getMaxOccurs();

            for (int i = 1; i < modelGroupParticles.length; ++i)
            {
               intermediateParticle = modelGroupParticles[i];

               assert intermediateParticle.getTerm() instanceof XSModelGroup;

               nMinOccurs = getMinOccurs(modelGroupParticles, i, Math.min(nMinOccurs, intermediateParticle.getMinOccurs()), part);
              
               if (nMaxOccurs != 0)
               {
                  nMaxOccurs = intermediateParticle.getMaxOccursUnbounded() ? 0 : Math.max(nMaxOccurs, intermediateParticle.getMaxOccurs());
               }
            }
           
            part.setMinCount(Math.min(nMinOccurs, part.getMinCount()));
           
View Full Code Here

             *       element name="phone"
             *    </sequence
             *    <sequence
             *       ...
             */
            XSParticle p = modelGroupParticles[nIndex];
  
            if (isChoice(p) && ((XSModelGroup)p.getTerm()).getParticles().getLength() > 1)
            {
               return 0;
            }
         }
         else if (nIndex == modelGroupParticles.length - 1 && isChoice(modelGroupParticles[nIndex]))
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSParticle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.