Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSModelGroup


      short xsTermType = xsTerm.getType();
      String termStr = null;
      if(xsTermType == XSConstants.MODEL_GROUP)
      {
         termStr = "sequence";
         XSModelGroup xsModelGroup = (XSModelGroup)xsTerm;
         short xsModelGroupCompositor = (xsModelGroup).getCompositor();
         if(XSModelGroup.COMPOSITOR_CHOICE == xsModelGroupCompositor)
            termStr = "choice";
         else if(XSModelGroup.COMPOSITOR_ALL == xsModelGroupCompositor)
            termStr = "all";

         if(!termBinding.isModelGroup())
         {
            // TODO review this
            // let's see whether it's wrapped
            if(xsModelGroup.getParticles().getLength() == 1)
            {
               XSParticle xsWrappedParticle = (XSParticle) xsModelGroup.getParticles().item(0);
               assertEquivalent(xsWrappedParticle, particleBinding);
            }
            else
               fail("TermBinding expected to be a " + termStr + " but was " + termBinding);
         }
View Full Code Here


         }
         else if(termType == XSConstants.WILDCARD)
            elementParticles.put(WILDCARD, particle);
         else
         {
            XSModelGroup modelGroup = (XSModelGroup) term;
            flatten(modelGroup, elementParticles);
         }
      }
   }
View Full Code Here

      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

         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

      if (xsparticle != null)
      {
         XSTerm xsterm = xsparticle.getTerm();
         if (xsterm instanceof XSModelGroup)
         {
            XSModelGroup xsm = (XSModelGroup)xsterm;
            XSObjectList xparts = xsm.getParticles();
            //Ignore the first item - that will be a modelgroup for basetype
            XSParticle xspar = (XSParticle)xparts.item(1);
            XSTerm xterm = xspar.getTerm();
            if (xterm instanceof XSElementDeclaration)
            {
               vars.addAll(createVARforXSElementDeclaration(xterm, schemautils.isArrayType(xspar), schema, type));
            }
            else if (xterm instanceof XSModelGroup)
            {
               XSModelGroup xsmodelgrp = (XSModelGroup)xterm;
               vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
            }
         }
      }
   }
View Full Code Here

      if (xsparticle != null)
      {
         XSTerm xsterm = xsparticle.getTerm();
         if (xsterm instanceof XSModelGroup)
         {
            XSModelGroup xsm = (XSModelGroup)xsterm;
            XSObjectList xparts = xsm.getParticles();

            int length = xparts.getLength();

            XSTypeDefinition baseType = type.getBaseType();

            if (baseType instanceof XSComplexTypeDefinition && ((XSComplexTypeDefinition)baseType).getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
            {
               XSTerm baseTerm = ((XSComplexTypeDefinition)baseType).getParticle().getTerm();
               if (isExceptionType && baseTerm instanceof XSModelGroup)
               {
                  typeNameToBaseVARList.put(type.getName(), createVARsforXSModelGroup((XSModelGroup)baseTerm, schema, type));
               }

               // HACK - The only way to know what elements are local to the subclass, and not inherited, is to compare to the base class
               // THIS TIES US TO XERCES
               if (baseType instanceof XSComplexTypeDefinition == false || ((XSComplexTypeDefinition)baseType).getParticle().getTerm() == xsterm)
                  return;
            }

            XSParticle xspar;

            if (baseType instanceof XSComplexTypeDefinition && ((XSComplexTypeDefinition)baseType).getContentType() == XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
            {
               // If the base type is empty there will not have been a particle to ignore.
               xspar = xsparticle;
            }
            else
            {
               xspar = (XSParticle)xparts.item(length - 1);
            }

            XSTerm xsparTerm = xspar.getTerm();
            if (xsparTerm instanceof XSModelGroup)
            {
               XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
               vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
            }
            else if (xsparTerm instanceof XSElementDeclaration)
               vars.addAll(createVARforXSElementDeclaration(xsparTerm, schemautils.isArrayType(xspar), schema, type));
View Full Code Here

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

      if (xsparticle != null)
      {
         XSTerm xsterm = xsparticle.getTerm();
         if (xsterm instanceof XSModelGroup)
         {
            XSModelGroup xsm = (XSModelGroup)xsterm;
            XSObjectList xparts = xsm.getParticles();
            int len = xparts != null ? xparts.getLength() : 0;
            int diff = len - 0;

            for (int i = 0; i < len; i++)
            {
               if (isExceptionType && type.getBaseType() != null)
               {
                  List<VAR> baseList = new ArrayList<VAR>();

                  //The first few xsterms are modelgroups for base class
                  for (int j = 0; j < diff - 1; j++)
                  {
                     XSParticle xspar = (XSParticle)xparts.item(j);
                     XSTerm xsparTerm = xspar.getTerm();
                     if (xsparTerm instanceof XSModelGroup)
                     {
                        XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
                        baseList.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
                     }

                  }
                  if (baseList.size() > 0)
                     this.typeNameToBaseVARList.put(type.getName(), baseList);
                  //Now take the modelgroup for the type in question
                  XSParticle xspar = (XSParticle)xparts.item(len - 1);
                  XSTerm xsparTerm = xspar.getTerm();
                  if (xsparTerm instanceof XSModelGroup)
                  {
                     XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
                     vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
                  }
                  break;
               }
               XSParticle xspar = (XSParticle)xparts.item(i);
               XSTerm xsparTerm = xspar.getTerm();
               if (xsparTerm instanceof XSModelGroup)
               {
                  XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
                  vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
               }
               else if (xsparTerm instanceof XSElementDeclaration)
                  vars.addAll(createVARforXSElementDeclaration(xsparTerm, schemautils.isArrayType(xspar), schema, type));
            }
View Full Code Here

         {

         }
         else if (xsterm instanceof XSModelGroup)
         {
            XSModelGroup xsm = (XSModelGroup)xsterm;
            XSObjectList xparts = xsm.getParticles();
            list.addAll(createVARsForElements(xparts, schema, type));
         }
      }
      return list;
   }
View Full Code Here

         String temp = this.fname;
         // Unwrap any array wrappers
         if (SchemaUtils.isWrapperArrayType(xstypedef))
         {
            XSComplexTypeDefinition complex = (XSComplexTypeDefinition)xstypedef;
            XSModelGroup group = (XSModelGroup)complex.getParticle().getTerm();
            XSElementDeclaration element = (XSElementDeclaration)((XSParticle)group.getParticles().item(0)).getTerm();
            xstypedef = element.getTypeDefinition();
            xstypename = xstypedef.getName();
            arrayType = true;
         }
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.