Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSTerm


         int len = xsobjlist.getLength();

         for (int i = 0; i < len; i++)
         {
            XSParticle xsparticle = (XSParticle)xsobjlist.item(i);
            XSTerm term = xsparticle.getTerm();

            if (term instanceof XSElementDeclaration)
            {
               vars.addAll(createVARforXSElementDeclaration(term, schemautils.isArrayType(xsparticle), schema, origType));
            }
View Full Code Here


      List<VAR> list = new ArrayList<VAR>();
      int len = xsobjlist.getLength();
      for (int i = 0; i < len; i++)
      {
         XSParticle xsparticle = (XSParticle)xsobjlist.item(i);
         XSTerm xsterm = xsparticle.getTerm();

         list.addAll(createVARforXSElementDeclaration(xsterm, schemautils.isArrayType(xsparticle), schema, origType));
         continue;
      }
View Full Code Here

      return binding;
   }

   private static void bindParticle(Context ctx, XSParticle particle)
   {
      XSTerm term = particle.getTerm();
      switch(term.getType())
      {
         case XSConstants.MODEL_GROUP:
            XSModelGroup modelGroup = (XSModelGroup)term;
            // todo: investigate this
            if(modelGroup.getParticles().getLength() > 0)
            {
               ModelGroupBinding groupBinding;
               switch(modelGroup.getCompositor())
               {
                  case XSModelGroup.COMPOSITOR_ALL:
                     groupBinding = new AllBinding(ctx.schema);
                     break;
                  case XSModelGroup.COMPOSITOR_CHOICE:
                     groupBinding = new ChoiceBinding(ctx.schema);
                     break;
                  case XSModelGroup.COMPOSITOR_SEQUENCE:
                     groupBinding = new SequenceBinding(ctx.schema);
                     break;
                  default:
                     throw new JBossXBRuntimeException("Unexpected model group: " + modelGroup.getCompositor());
               }

               ParticleBinding particleBinding = new ParticleBinding(groupBinding);
               particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded());
               particleBinding.setMinOccurs(particle.getMinOccurs());
               particleBinding.setMaxOccurs(particle.getMaxOccurs());

               if (ctx.trace)
               {
                  log.trace("created model group " + groupBinding);
               }

               if (ctx.processAnnotations)
               {
                  XSAnnotation annotation = modelGroup.getAnnotation();
                  if(annotation != null)
                  {
                     customizeTerm(annotation, groupBinding, ctx.trace);
                  }
               }

               Object o = ctx.peekTypeOrGroup();
               if(o instanceof ModelGroupBinding)
               {
                  ModelGroupBinding parentGroup = (ModelGroupBinding)o;
                  parentGroup.addParticle(particleBinding);
                  if (ctx.trace)
                  {
                     log.trace("added " + groupBinding + " to " + parentGroup);
                  }
               }
               else if(o instanceof TypeBinding)
               {
                  TypeBinding typeBinding = (TypeBinding)o;
                  typeBinding.setParticle(particleBinding);
                  if (ctx.trace)
                  {
                     log.trace("added " + groupBinding + " to type " + typeBinding.getQName());
                  }
               }

               ctx.pushModelGroup(groupBinding);
               bindModelGroup(ctx, modelGroup);
               ctx.popModelGroup();
            }
            break;
         case XSConstants.WILDCARD:
            bindWildcard(ctx, particle);
            break;
         case XSConstants.ELEMENT_DECLARATION:
            bindElement(ctx,
               (XSElementDeclaration)term,
               particle.getMinOccurs(),
               particle.getMaxOccurs(),
               particle.getMaxOccursUnbounded()
            );
            break;
         default:
            throw new IllegalStateException("Unexpected term type: " + term.getType());
      }
   }
View Full Code Here

   {
      XSObjectList particles = group.getParticles();
      for(int j = 0; j < particles.getLength(); ++j)
      {
         XSParticle particle = (XSParticle)particles.item(j);
         XSTerm term = particle.getTerm();
         switch(term.getType())
         {
            case XSConstants.ELEMENT_DECLARATION:
               XSElementDeclaration element = ((XSElementDeclaration)term);
               sharedElements.add(element);
               break;
View Full Code Here

    private static String inspectComplexType(XSComplexTypeDefinition ctypedef) {
        StringBuilder sig = new StringBuilder();
        XSParticle particle = ctypedef.getParticle();
        if (null != particle) {
            XSTerm term = particle.getTerm();
            sig.append(ComplexTypeDescription.inspectTerm(term));
        }
        return sig.toString();
    }
View Full Code Here

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

        XSObjectList attributes = ctypedef.getAttributeUses();
        onVisitAttributes(attributes, ctypedef);

        XSParticle particle = ctypedef.getParticle();
        if (null != particle) {
            XSTerm term = particle.getTerm();
            // according to [1]#Interface-XSParticle this should be either a
            // model group, an element or a wildcard declaration
            onVisitTerm(ctypedef, term);
        }
View Full Code Here

                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);
                }
                break;
            case XSConstants.ELEMENT_DECLARATION:
                XsModelWalker.logger.debug("==> found element declaration");
View Full Code Here

    public static Collection<XSObject> flat(XSObjectList list) {
        Collection<XSObject> collection = new ArrayList<XSObject>();
        for (int i = 0; i < list.getLength(); i++) {
            final Object item = list.item(i);
            if (item instanceof XSParticle) {
                XSTerm term = ((XSParticle) item).getTerm();
                if (term instanceof XSModelGroup) {
                    collection.addAll(XSModelHelper.flat(((XSModelGroup) term).getParticles()));
                }

                else {
View Full Code Here

      XSParticle xsp = xc.getParticle();
      if (xsp == null)
         return null;

      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();
      if ((xp.getMaxOccursUnbounded() || xp.getMaxOccurs() > 1) == false || term instanceof XSElementDeclaration == false)
         return null;

      return (XSElementDeclaration)term;
   }
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.