Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSTerm


   {
      XSObjectList xo = xm.getParticles();
      int len = xo != null ? xo.getLength() : 0;
      for (int i = 0; i < len; i++)
      {
         XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
         if (xsterm instanceof XSModelGroup)
            addVariableMappingMap((XSModelGroup)xsterm, jxtm, javaType);
         else if (xsterm instanceof XSElementDeclaration)
         {
            XSElementDeclaration xe = (XSElementDeclaration)xsterm;
View Full Code Here


   {
      XSObjectList xo = xm.getParticles();
      int len = xo != null ? xo.getLength() : 0;
      for (int i = 0; i < len; i++)
      {
         XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
         if (xsterm instanceof XSModelGroup)
         {
            addGroup((XSModelGroup)xsterm, containingElement, containingType, jwm);
         }
         else if (xsterm instanceof XSElementDeclaration)
View Full Code Here

        addRelatedAttribute(component.getAttrDeclaration(), componentList, namespace, dependencies);
    }

    private void expandRelatedParticleComponents(XSParticle component, Vector componentList,
            String namespace, Hashtable dependencies) {
        XSTerm term = component.getTerm();
        switch (term.getType()) {
        case XSConstants.ELEMENT_DECLARATION :
            addRelatedElement((XSElementDeclaration) term, componentList, namespace, dependencies);
            break;
        case XSConstants.MODEL_GROUP :
            expandRelatedModelGroupComponents((XSModelGroup) term, componentList, namespace, dependencies);
View Full Code Here

         XSModelGroup group = groupDef.getModelGroup();
         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 void bindParticle(SchemaBinding schema, XSParticle particle, SharedElements sharedElements)
   {
      XSTerm term = particle.getTerm();
      switch(term.getType())
      {
         case XSConstants.MODEL_GROUP:
            bindModelGroup(schema, (XSModelGroup)term, sharedElements);
            break;
         case XSConstants.WILDCARD:
            bindWildcard(schema, (XSWildcard)term);
            break;
         case XSConstants.ELEMENT_DECLARATION:
            bindElement(schema,
               (XSElementDeclaration)term,
               sharedElements,
               particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1
            );
            break;
         default:
            throw new IllegalStateException("Unexpected term type: " + term.getType());
      }
   }
View Full Code Here

   }

   private boolean marshalParticle(XSParticle particle, boolean declareNs)
   {
      boolean marshalled;
      XSTerm term = particle.getTerm();
      switch(term.getType())
      {
         case XSConstants.MODEL_GROUP:
            marshalled = marshalModelGroup((XSModelGroup)term, declareNs);
            break;
         case XSConstants.WILDCARD:
            marshalled = marshalWildcard((XSWildcard)term, declareNs);
            break;
         case XSConstants.ELEMENT_DECLARATION:
            XSElementDeclaration element = (XSElementDeclaration)term;
            marshalled =
               marshalElement(element.getNamespace(),
                  element.getName(),
                  element.getTypeDefinition(),
                  element.getNillable(),
                  particle.getMinOccurs(),
                  particle.getMaxOccurs(),
                  declareNs
               );
            break;
         default:
            throw new IllegalStateException("Unexpected term type: " + term.getType());
      }
      return marshalled;
   }
View Full Code Here

   private static void bindParticle(DocumentBinding doc,
                                    ParentElement parent,
                                    XSParticle particle)
   {
      XSTerm term = particle.getTerm();
      switch(term.getType())
      {
         case XSConstants.MODEL_GROUP:
            bindModelGroup(doc, parent, (XSModelGroup)term);
            break;
         case XSConstants.WILDCARD:
            // todo bindWildcard((XSWildcard)term);
            break;
         case XSConstants.ELEMENT_DECLARATION:
            bindElement(doc, parent, (XSElementDeclaration)term);
            break;
         default:
            throw new IllegalStateException("Unexpected term type: " + term.getType());
      }
   }
View Full Code Here

   }

   private boolean marshalParticle(XSParticle particle)
   {
      boolean marshalled;
      XSTerm term = particle.getTerm();
      switch (term.getType())
      {
         case XSConstants.MODEL_GROUP:
            marshalled = marshalModelGroup((XSModelGroup)term);
            break;
         case XSConstants.WILDCARD:
            marshalled = marshalWildcard((XSWildcard)term);
            break;
         case XSConstants.ELEMENT_DECLARATION:
            marshalled = marshalElement((XSElementDeclaration)term, particle.getMinOccurs(), particle.getMaxOccurs());
            break;
         default:
            throw new IllegalStateException("Unexpected term type: " + term.getType());
      }
      return marshalled;
   }
View Full Code Here

        addRelatedAttribute(component.getAttrDeclaration(), componentList, namespace, dependencies);
    }

    private void expandRelatedParticleComponents(XSParticle component, Vector componentList,
            String namespace, Hashtable dependencies) {
        XSTerm term = component.getTerm();
        switch (term.getType()) {
        case XSConstants.ELEMENT_DECLARATION :
            addRelatedElement((XSElementDeclaration) term, componentList, namespace, dependencies);
            break;
        case XSConstants.MODEL_GROUP :
            expandRelatedModelGroupComponents((XSModelGroup) term, componentList, namespace, dependencies);
View Full Code Here

     * particleToDefs
     */
    private boolean particleToDefs(XSParticle particle, List propDefList, List nodeDefList) throws SchemaConversionException {
        boolean orderable = false;

        XSTerm term = particle.getTerm();

        // If the maxoccurs setting of this particle is zero then this
        // particle does not contribute any node or property definition and
        // we do nothing and return.
        if (particle.getMaxOccurs() == 0) {
            return orderable;
        }

        // Determine the mandatory setting of the node or property
        // corresponding to this particle (if this particle does not
        // correspond to node or property this information is ignored).
        boolean mandatory = false;
        if (particle.getMinOccurs() > 0) {
            mandatory = true;
        }

        // Determine the same-name siblings setting of the node, or
        // the multiple setting of the property, corresponding to this
        // particle (if this particle does not correspond to
        // node or property this information is ignored).
        boolean multiple = false;
        if (particle.getMaxOccurs() > 1 || particle.getMaxOccursUnbounded()) {
            multiple = true;
        }

        // If this particle is an element declaration (an <xs:element>)
        // then it is converted into either a node or property def.
        if (term.getType() == XSConstants.ELEMENT_DECLARATION) {
            XSElementDeclaration eDec = (XSElementDeclaration) term;

            // Name for property or node def taken from the name of the element
            QName name = new QName(noNull(eDec.getNamespace()), eDec.getName());

            // Get the type definition for this element declaration
            XSTypeDefinition tDef = eDec.getTypeDefinition();

            // If this element declaration is of simple type
            // then it is converted into a property def
            if (tDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                XSSimpleTypeDefinition stDef = (XSSimpleTypeDefinition) tDef;
                PropDef propDef = simpleTypeToPropDef(stDef, name, mandatory, multiple);
                propDefList.add(propDef);

                // If this element declaration is of complex type then
                // it is converted into either node or property def
            } else if (tDef.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
                XSComplexTypeDefinition ctDef = (XSComplexTypeDefinition) tDef;

                // If the complex type definition contains a simple content model
                // and does not contain any attribute uses or attribute wildcards
                // then the enclosing element is converted to a property def
                if (ctDef.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE &&
                        ctDef.getAttributeUses().getLength() == 0 && ctDef.getAttributeWildcard() == null) {
                    XSSimpleTypeDefinition std = ctDef.getSimpleType();
                    PropDef pd = simpleTypeToPropDef(std, name, mandatory, multiple);
                    propDefList.add(pd);

                    // If the complex type definition contains a complex content model
                    // or a simple content model with attribute uses or an attribute wildcard
                    // then the enclosing element is converted into a node def
                } else {
                    NodeDef nd = complexTypeToNodeDef(ctDef, name, mandatory, multiple);
                    nodeDefList.add(nd);
                }
            }

            // If this particle is a wildcard (an <xs:any> )then it
            // is converted into a node def.
        } else if (term.getType() == XSConstants.WILDCARD) {
            nodeDefList.add(wildcardNodeDef());

            // If this particle is a model group (one of
            // <xs:sequence>, <xs:choice> or <xs:all>) then
            // it subparticles must be processed.
        } else if (term.getType() == XSConstants.MODEL_GROUP) {
            XSModelGroup mg = (XSModelGroup) term;

            // If the top level compositor is <xs:sequence> we convert this to
            // mean that the node type corresponding to the complex type def will have
            // an orderable setting of true.
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.