Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSParticle


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

      for (int i = 0; i < lenobj; i++)
      {
         XSParticle jxsp = (XSParticle)objlist.item(i);
         XSTerm xterm = jxsp.getTerm();
         short termType = xterm.getType();
         if (termType == XSConstants.ELEMENT_DECLARATION)
         {
            XSElementDeclaration xsel = (XSElementDeclaration)jxsp.getTerm();
            buf.append(this.write(xsel, jxsp));
         }
         else if (termType == XSConstants.MODEL_GROUP)
         {
            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 xsterm = jxp.getTerm();
               termType = xsterm.getType();
               if (termType == XSConstants.ELEMENT_DECLARATION)
                  buf.append(write((XSElementDeclaration)xsterm, jxsp));
               else if (termType == XSConstants.MODEL_GROUP && k > 0)
                  buf.append(write((XSModelGroup)xsterm));
View Full Code Here


         {
            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

      if (hasAttributes)
         throw new WSException("[JAX-RPC 2.3.1.2] Can not unwrap, complex type contains attributes.");

      boolean unwrappedElement = false;

      XSParticle particle = wrapper.getParticle();
      if (particle == null)
      {
         unwrappedElement = true;
      }
      else
      {
         XSTerm term = particle.getTerm();
         if (term instanceof XSModelGroup)
         {
            unwrappedElement = unwrapGroup(tempBuf, containingElement, (XSModelGroup)term);
         }
      }
View Full Code Here

         return false;

      XSObjectList particles = group.getParticles();
      for (int i = 0; i < particles.getLength(); i++)
      {
         XSParticle particle = (XSParticle)particles.item(i);
         XSTerm term = particle.getTerm();
         if (term instanceof XSModelGroup)
         {
            if (unwrapGroup(buf, containingElement, (XSModelGroup)term) == false)
               return false;
         }
         else if (term instanceof XSElementDeclaration)
         {
            if (buf.length() > 0)
               buf.append(", ");

            XSElementDeclaration element = (XSElementDeclaration)term;
            XSTypeDefinition type = element.getTypeDefinition();
            String tempContainingElement = containingElement + ToolsUtils.firstLetterUpperCase(element.getName());

            QName xmlType = null;
            if (type.getAnonymous() == false)
               xmlType = new QName(type.getNamespace(), type.getName());

            JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
            boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1;
            boolean primitive = !(element.getNillable() || (particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1));
            generateParameter(buf, tempContainingElement, xmlType, xsmodel, type, array, primitive, false);

            String paramName;
            if (type.getAnonymous())
            {
View Full Code Here

      if (hasAttributes)
         throw new WSException("[JAX-RPC 2.3.1.2] Can not unwrap, complex type contains attributes.");

      boolean unwrapped = false;

      XSParticle particle = wrapper.getParticle();
      if (particle != null)
      {
         XSTerm term = particle.getTerm();

         if (term instanceof XSModelGroup == false)
            throw new WSException("[JAX-RPC 2.3.1.2] Expected model group, could not unwrap");

         XSModelGroup group = (XSModelGroup)term;
View Full Code Here

   private boolean unwrapModelGroup(XSModelGroup group)
   {
      XSObjectList particles = group.getParticles();
      if (particles.getLength() == 1)
      {
         XSParticle particle = (XSParticle)particles.item(0);
         boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1;
         XSTerm term = particle.getTerm();

         if (term instanceof XSModelGroup)
         {
            return unwrapModelGroup((XSModelGroup)term);
         }
         else if (term instanceof XSElementDeclaration)
         {
            unwrappedElement = (XSElementDeclaration)term;
            XSTypeDefinition type = unwrappedElement.getTypeDefinition();
            if (type.getAnonymous() == false)
               xmlType = new QName(unwrappedElement.getTypeDefinition().getNamespace(), unwrappedElement.getTypeDefinition().getName());

            this.array = array;
            primitive = !(unwrappedElement.getNillable() || (particle.getMinOccurs() == 0 && particle.getMaxOccurs() == 1));
         }

      }
      else
      {
View Full Code Here

      }

      // Follow the order of elementNames
      for (QName name : elementNames.values())
      {
         XSParticle found = index.get(name.getLocalPart());
         if (found != null)
         {
            index.remove(name.getLocalPart());
            newList.add(found);
         }
View Full Code Here

      {
         XSTypeDefinition btype = baseType.getBaseType();
         if (btype != null)
            addBaseTypeParts(btype, xsparts); //Recurse
         //Just add the particles from this basetype as a ModelGroup sequence
         XSParticle part = ((XSComplexTypeDefinition)baseType).getParticle();
         XSTerm term = part.getTerm();
         if (term instanceof XSModelGroup)
         {
            JBossXSParticle p = new JBossXSParticle();
            p.setTerm(term);
            xsparts.add(p);
View Full Code Here

      {
         particles.add(getXSParticle(name, type, targetNS));
         return;
      }

      XSParticle particle = particles.get(0);
      XSTerm term = particle.getTerm();
      if (term.getType() == XSConstants.MODEL_GROUP)
      {
         JBossXSModelGroup group = (JBossXSModelGroup)term;
         XSObjectList list = group.getParticles();
         ArrayList<XSParticle> baseParticles = new ArrayList<XSParticle>();
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.