Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSModelGroup


         if (term == null)
            return;
         switch (term.getType())
         {
            case XSConstants.MODEL_GROUP:
               XSModelGroup group = (XSModelGroup)term;
               XSObjectList list = group.getParticles();
               for (int i = 0; i < list.getLength(); i++)
                  analyzeParticle((XSParticle)list.item(i), parentName, namespace);
               break;
            case XSConstants.ELEMENT_DECLARATION:
               XSElementDeclaration decl = (XSElementDeclaration)term;
View Full Code Here


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

   {
      XSTerm term = particle.getTerm();

      if (term.getType() == XSConstants.MODEL_GROUP)
      {
         XSModelGroup modelGroup = (XSModelGroup)term;
         XSObjectList particleList = modelGroup.getParticles();
        
         if (particleList.getLength() > 1)
         {
            //inspect children
            boolean bHasElement = hasElement(particle);
            List modelGroupList = getModelGroups(particle);

            //search for children that are model groups of type choice
            for (int i = 0; i < modelGroupList.size(); i++)
            {
               XSParticle childParticle = (XSParticle)modelGroupList.get(i);
               XSTerm childTerm = childParticle.getTerm();

               assert childTerm.getType() == XSConstants.MODEL_GROUP;

               if (bHasElement || modelGroupList.size() > 1 || bHasUncle)
               {
                  XSModelGroup childModelGroup = (XSModelGroup)childTerm;

                  if (childModelGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE
                     && (childParticle.getMaxOccursUnbounded() || childParticle.getMaxOccurs() > 1)
                     && hasDescendantElements(childParticle, 1))
                  {
                     return true;
                  }
                  else if (childModelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE)
                  {
                     //bHasUncle is set true because at least one of the following is true:
                     // 1. childModelGroup has a sibling element
                     // 2. childModelGroup has a sibling model group with a descendant element
                     // 3. childModelGroup has an uncle element or uncle model group with a descendant element
View Full Code Here

      List retVal = new ArrayList();
      XSTerm term = particle.getTerm();

      if (term.getType() == XSConstants.MODEL_GROUP)
      {
         XSModelGroup modelGroup = (XSModelGroup)term;
         XSObjectList particleList = modelGroup.getParticles();

         //inspect particles and remember the ones with element descendants
         for (int i = 0; i < particleList.getLength(); i++)
         {
            XSParticle childParticle = (XSParticle)particleList.item(i);
View Full Code Here

         case XSConstants.MODEL_GROUP:
            //determine if aggregation should be random
            if (parentPart.getAggregation() != CompositeMessagePart.RANDOM)
            {
               boolean bSetRandom = false;
               XSModelGroup modelGroup = (XSModelGroup)term;

               if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE)
               {
                  if (isMaxOccursGreaterThanOne(childParticle) && hasDescendantElements(childParticle, 1))
                  {
                     bSetRandom = true;
                  }
               }
               else if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE)
               {
                  //does it have choice as child with sibling or uncle
                  if (hasChoiceDescendantWithSiblingOrUncleElement(childParticle, false))
                  {
                     bSetRandom = true;
View Full Code Here

      XSParticle xspart =  xc.getParticle();
      assertNotNull("Particle is null?",xspart);
      XSTerm xsterm = xspart.getTerm();
      assertNotNull("XSTerm is null?",xsterm);
      assertTrue("XSTerm is a model group",xsterm instanceof XSModelGroup);
      XSModelGroup xm = (XSModelGroup)xsterm;
      XSObjectList objlist = xm.getParticles();
      XSParticle xp = (XSParticle)objlist.item(0);
      assertTrue("First particle is XSElementDeclaration", xp.getTerm() instanceof XSElementDeclaration);

   }
View Full Code Here

      XSTypeDefinition defi = xsmodel.getTypeDefinition(">>root>inside", "http://org.jboss.ws/anonymous/types");
      assertEquals(defi.getTypeCategory(), XSTypeDefinition.COMPLEX_TYPE);
      XSComplexTypeDefinition complex = (XSComplexTypeDefinition) defi;
      XSTerm term = complex.getParticle().getTerm();
      assertEquals(term.getType(), XSConstants.MODEL_GROUP);
      XSModelGroup group = (XSModelGroup) term;
      XSParticle particle = (XSParticle) group.getParticles().item(0);
      term = particle.getTerm();
      assertEquals(term.getType(), XSConstants.ELEMENT_DECLARATION);
      assertEquals(((XSElementDeclaration) term).getName(), "data2");
   }
View Full Code Here

        }
       
        if (isGlobal) {
            String groupName = groupDecl.getName();
            groupDeclDomNode.setAttributeNS(null, "name", groupName);
            XSModelGroup modelGroup = groupDecl.getModelGroup();
            if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) {
                addCompositorOnSchemaComponent(document, groupDeclDomNode,
                                               modelGroup, "sequence", "1", "1");
            }
            else if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE) {
                addCompositorOnSchemaComponent(document, groupDeclDomNode,
                                               modelGroup, "choice", "1", "1");
            }
            else if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_ALL) {
                addAllCompositorOnComplexType(document, groupDeclDomNode,
                                              modelGroup, "1", "1");
            }
        }
        else {
View Full Code Here

                                                XSParticle particle)
                                                throws DOMException {
        XSTerm particleTerm = particle.getTerm();
       
        if (particleTerm instanceof XSModelGroup) {
            XSModelGroup modelGroup = (XSModelGroup) particleTerm;
            String minOccurs = getMinOccursVal(particle);
            String maxOccurs = getMaxOccursVal(particle);
            if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE) {
                addCompositorOnSchemaComponent(document, parentDomNode,
                                               modelGroup, "sequence",
                                               minOccurs,
                                               maxOccurs);
            }
            else if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE) {
                addCompositorOnSchemaComponent(document, parentDomNode,
                                               modelGroup, "choice",
                                               minOccurs,
                                               maxOccurs);
            }
            else if (modelGroup.getCompositor() == XSModelGroup.COMPOSITOR_ALL) {
                addAllCompositorOnComplexType(document, parentDomNode,
                                              modelGroup,
                                              minOccurs,
                                              maxOccurs);
            }
View Full Code Here

                                               maxOccursParticle,
                                               false);
            }
            else if (partclTerm instanceof XSModelGroup) {
                // Recursively adding model groups
                XSModelGroup partlModelGroup = (XSModelGroup) partclTerm;
                if (partlModelGroup.getCompositor() ==
                                XSModelGroup.COMPOSITOR_CHOICE) {
                    addCompositorOnSchemaComponent(document, compositorDomNode,
                                                   partlModelGroup, "choice",
                                                   minOccursParticle,
                                                   maxOccursParticle);
                }
                else if (partlModelGroup.getCompositor() ==
                                XSModelGroup.COMPOSITOR_SEQUENCE) {
                    addCompositorOnSchemaComponent(document, compositorDomNode,
                                                   partlModelGroup, "sequence",
                                                   minOccursParticle,
                                                   maxOccursParticle)
View Full Code Here

TOP

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

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.