Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSTerm


      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


   }

   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

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

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

      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

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

   {
      Map<String, XSParticle> index = new LinkedHashMap<String, XSParticle>();
      List<XSParticle> newList = new ArrayList<XSParticle>();
      for (XSParticle particle : particles)
      {
         XSTerm term = particle.getTerm();
         if (term instanceof XSElementDeclaration)
            index.put(((XSElementDeclaration)term).getName(), particle);
         else newList.add(particle);
      }
View Full Code Here

   private void addVariableMappings(Class javaType, JavaXmlTypeMapping javaXmlTypeMapping, List<XSParticle> particles, Map<String, String> reversedNames)
   {
      for (XSParticle particle : particles)
      {
         XSTerm term = particle.getTerm();
         if (term.getType() == XSConstants.MODEL_GROUP)
         {
            XSModelGroup group = (XSModelGroup)term;
            XSObjectList list = group.getParticles();
            ArrayList<XSParticle> baseParticles = new ArrayList<XSParticle>();
            for (int i = 0; i < list.getLength(); i++)
               baseParticles.add((XSParticle)list.item(i));

            addVariableMappings(javaType, javaXmlTypeMapping, baseParticles, null);

            continue;
         }

         String name = term.getName();
         String variableName = name;
         if (reversedNames != null && reversedNames.get(name) != null)
            variableName = reversedNames.get(name);

         VariableMapping mapping = new VariableMapping(javaXmlTypeMapping);
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>();
         for (int i = 0; i < list.getLength(); i++)
View Full Code Here

TOP

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

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.