Examples of XSModelGroup


Examples of org.apache.xerces.xs.XSModelGroup

    private static String inspectTerm(XSTerm term) {
        StringBuilder sig = new StringBuilder();
        switch (term.getType()) {
            case XSConstants.MODEL_GROUP:
                AbstractTypeDescription.logger.debug("==> found model group");
                XSModelGroup group = (XSModelGroup) term;
                sig.append(":").append(XSModelHelper.compositorToString(group.getCompositor()));
                sig.append("[");
                XSObjectList list = group.getParticles();
                List<String> subSignatures = new ArrayList<String>();
                for (int i = 0; i < list.getLength(); ++i) {
                    XSParticle part = (XSParticle) list.item(i);
                    XSTerm item = part.getTerm();
                    AbstractTypeDescription.logger.debug("==--> embedded [{" + item.getNamespace() + "}:" + item.getName() + "]");
                    subSignatures.add(ComplexTypeDescription.inspectTerm(item));
                }

                /*
                 * choice elements may differ in their definition order describing the same content model for example:
                 * {@code
                 *
                 * <xs:choice>
                 *
                 * <xs:element name="eihter" type="xs:string"/>
                 *
                 * <xs:element name="or" type="xs:float"/>
                 *
                 * </xs:choice>
                 *
                 * }
                 *
                 * may be equivalent to {@code
                 *
                 * <xs:choice>
                 *
                 * <xs:element name="or" type="xs:float"/>
                 *
                 * <xs:element name="either" type="xs:string"/>
                 *
                 * </xs:choice>
                 *
                 * }
                 */
                if (group.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE) {
                    Collections.sort(subSignatures);
                }
                for (String subSig : subSignatures) {
                    sig.append(subSig).append("|");
                }
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

        short termType = term.getType();

        switch (termType) {
            case XSConstants.MODEL_GROUP:
                XsModelWalker.logger.debug("==> found model group");
                XSModelGroup group = (XSModelGroup) term;
                XSObjectList list = group.getParticles();
                for (int i = 0; i < list.getLength(); ++i) {
                    XSParticle part = (XSParticle) list.item(i);
                    XSTerm item = part.getTerm();
                    XsModelWalker.logger.debug("==--> embedded [{" + item.getNamespace() + "}:" + item.getName() + "]");
                    onVisitTerm(ctypedef, item);
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

      XSTerm xsterm = xsp.getTerm();
      if (xsterm instanceof XSModelGroup == false)
         return null;

      XSModelGroup xm = (XSModelGroup)xsterm;
      XSObjectList xo = xm.getParticles();
      if (xo.getLength() != 1)
         return null;

      XSParticle xp = (XSParticle)xo.item(0);
      XSTerm term = xp.getTerm();
View Full Code Here

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

Examples of org.apache.xerces.xs.XSModelGroup

         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

Examples of org.apache.xerces.xs.XSModelGroup

   {
      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

Examples of org.apache.xerces.xs.XSModelGroup

      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

Examples of org.apache.xerces.xs.XSModelGroup

         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

Examples of org.apache.xerces.xs.XSModelGroup

      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

Examples of org.apache.xerces.xs.XSModelGroup

      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
TOP
Copyright © 2018 www.massapi.com. 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.