Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSComplexTypeDefinition


      XSElementDeclaration decl = xsmodel.getElementDeclaration(">root>inside", "http://org.jboss.ws/anonymous/types");
      assertEquals(decl.getName(), "inside");

      XSTypeDefinition defi = xsmodel.getTypeDefinition(">>root>inside", "http://org.jboss.ws/anonymous/types");
      assertEquals(defi.getTypeCategory(), XSTypeDefinition.COMPLEX_TYPE);
      XSComplexTypeDefinition complex = (XSComplexTypeDefinition) defi;
      XSTerm term = complex.getParticle().getTerm();
      assertEquals(term.getType(), XSConstants.MODEL_GROUP);
      XSModelGroup group = (XSModelGroup) term;
      XSParticle particle = (XSParticle) group.getParticles().item(0);
      term = particle.getTerm();
      assertEquals(term.getType(), XSConstants.ELEMENT_DECLARATION);
View Full Code Here


      assertNotNull("Root type def not found", xsType);
      XOPScanner scanner = new XOPScanner();

      if (xsType instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
         XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);

         // it fails when getting a stack overflow ;)
      }
   }
View Full Code Here

      assertNotNull("Root type def not found", xsType);
      XOPScanner scanner = new XOPScanner();

      if (xsType instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
         XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
         assertNotNull("Unable to find xop typedef in schema", resultType);
      }

      scanner.reset();

      // test the xmime binary declaration
      xsType = schemaModel.getTypeDefinition(">PingMsgResponse", "http://jboss.org/test/ws/xop/doclit");
      assertNotNull("Root type def not found", xsType);
      if (xsType instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
         XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
         assertNotNull("Unable to find XOP typedef in schema", resultType);
      }

   }
View Full Code Here

      assertNotNull("Root type def not found", xsType);
      XOPScanner scanner = new XOPScanner();

      if (xsType instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition)xsType;
         XSTypeDefinition resultType = scanner.findXOPTypeDef(xsComplexType);
         assertNotNull("Unable to find xop typedef in schema", resultType);
      }
   }
View Full Code Here

       
        // simple type definition to be used, to get the facets
        XSSimpleTypeDefinition simpleTypeDefn = null;
       
        if (typeDefn instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition complexTypeDefn = (XSComplexTypeDefinition) typeDefn;
            simpleTypeDefn = complexTypeDefn.getSimpleType();
           
        }
        else {
            simpleTypeDefn = (XSSimpleTypeDefinition) typeDefn;    
        }
View Full Code Here

           String requiredVal = (attrUse.getRequired() == true) ?
                                 "required" : "optional";
          
           XSAttributeDecl attrDecl = (XSAttributeDecl)
                                                  attrUse.getAttrDeclaration();
           XSComplexTypeDefinition enclosingCTDefn = attrDecl.
                                                  getEnclosingCTDefinition();
           boolean complexTypesIdentical = XSTypeHelper.schemaTypesIdentical(
                                                            complexTypeDecl,
                                                            enclosingCTDefn);
           // do not add attributes, from the base type. they will be
View Full Code Here

    /*
     * Set value of XPath2 context variable $value, if element has a complex type with simple content.
     */
    private void setValueOf$ValueForCTWithSimpleContent(String value, XSComplexTypeDefinition typeDef) {
       
        XSComplexTypeDefinition cmplxTypeDef = (XSComplexTypeDefinition)typeDef;
        XSSimpleTypeDefinition complexTypeSimplContentType = cmplxTypeDef.getSimpleType();
        if (complexTypeSimplContentType.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST) {
            // simple content type has variety xs:list
            XSSimpleTypeDefinition listItemType = complexTypeSimplContentType.getItemType();
            // split the "string value" of list contents, into non white-space tokens.
            StringTokenizer values = new StringTokenizer(value, " \n\t\r");
           
            // construct a list of atomic XDM items, to assign to XPath2 context variable $value.
            List xdmItemList = new ArrayList();
            final XSObjectList memberTypes = listItemType.getMemberTypes();
            if (memberTypes.getLength() > 0) {
               // itemType of xs:list has variety 'union'. here list items may have different types, which are determined below.
               while (values.hasMoreTokens()) {
                   String itemValue = values.nextToken();
                   XSSimpleTypeDefinition listItemTypeForUnion = getActualListItemTypeForVarietyUnion(memberTypes, itemValue);
                   xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listItemTypeForUnion.getBuiltInKind(), itemValue));
               }                                 
            }
            else {
               // every list item has a same type (the itemType of xs:list).
               while (values.hasMoreTokens()) {
                   String itemValue = values.nextToken();
                   xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listItemType.getBuiltInKind(), itemValue));
               }                                 
            }

            // assign an XPath2 sequence to xpath context variable $value
            fDynamicContext.set_variable(new org.eclipse.wst.xml.xpath2.processor.internal.types.QName(
                                           "value"), getXPath2ResultSequence(xdmItemList));
        }
        else if (complexTypeSimplContentType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
            // simple content type has variety xs:union
            XSSimpleTypeDefinition simpleContentTypeForUnion = getActualListItemTypeForVarietyUnion
                                                                     (complexTypeSimplContentType.getMemberTypes(), value);
            fDynamicContext.set_variable(new org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
                                             SchemaTypeValueFactory.newSchemaTypeValue(simpleContentTypeForUnion.getBuiltInKind(),
                                             value));
        }
        else {
            // simple content type has variety atomic
            setValueOf$ValueForSTVarietyAtomic(value, getXercesXSDTypeCodeFor$Value(cmplxTypeDef.getSimpleType()));
        }
         
    } // setValueOf$ValueForCTWithSimpleContent
View Full Code Here

                    for (int i = 0, n = facets.size(); i < n; ++i) {
                        addComponent(facets.item(i), nameTest, targetComponents);
                    }
                }
            } else { // complex type
                XSComplexTypeDefinition cmplxType = ((XSComplexTypeDefinition)sourceComponent);
                if (NO_FILTER == filter || XSConstants.ATTRIBUTE_USE == filter) {
                    XSObjectList attributeUses = cmplxType.getAttributeUses();
                    for (int i = 0, n = attributeUses.size(); i < n; ++i) {
                        addComponent(attributeUses.item(i), nameTest, targetComponents);
                    }
                }
                int componentVariety = cmplxType.getContentType();
                switch (componentVariety) {
                case XSComplexTypeDefinition.CONTENTTYPE_EMPTY:
                    break;
                case XSComplexTypeDefinition.CONTENTTYPE_SIMPLE:
                    if (NO_FILTER == filter || XSConstants.TYPE_DEFINITION == filter) {
                        addComponent(cmplxType.getSimpleType(), nameTest, targetComponents);
                    }
                    break;
                default:
                    term(cmplxType, filter, nameTest, targetComponents);
                break;
View Full Code Here

       
        // simple type definition to be used, to get the facets
        XSSimpleTypeDefinition simpleTypeDefn = null;
       
        if (typeDefn instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition complexTypeDefn = (XSComplexTypeDefinition) typeDefn;
            simpleTypeDefn = complexTypeDefn.getSimpleType();
           
        }
        else {
            simpleTypeDefn = (XSSimpleTypeDefinition) typeDefn;    
        }
View Full Code Here

          
           String requiredVal = (attrUse.getRequired() == true) ? "required" : "optional";
          
           XSAttributeDecl attrDecl = (XSAttributeDecl)
                                                  attrUse.getAttrDeclaration();
           XSComplexTypeDefinition enclosingCTDefn = attrDecl.
                                                  getEnclosingCTDefinition();
           boolean complexTypesIdentical = (enclosingCTDefn == null) ? false : XSTypeHelper.isSchemaTypesIdentical(
                                                                                  complexTypeDecl, enclosingCTDefn);
           // do not add attributes, from the base type. they will be serialized as part of the base type serialization.
           if (complexTypesIdentical) {
View Full Code Here

TOP

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

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.