Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSComplexTypeDefinition


               return;
            }
         }
         else
         {
            XSComplexTypeDefinition complexType = (XSComplexTypeDefinition)particleTerm.getTypeDefinition();
           
            if (!isAnyType(complexType) && !isComposite(complexType, false))
            {
               part.setMinCount(0);
               part.setMaxCount(1);
View Full Code Here


   {
      XSTypeDefinition complexDefBaseType = complexDef.getBaseType();
     
      if (complexDefBaseType instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition typeDef = (XSComplexTypeDefinition)complexDefBaseType;
        
         if (isComposite(typeDef, true))
         {
            return typeDef;
         }
View Full Code Here

   // operations

   public static XSParticle getParticle(XSElementDeclaration elemDecl)
   {
      XSComplexTypeDefinition complexDef = getComplexTypeDef(elemDecl);
     
      if (complexDef == null)
      {
         return null;
      }
View Full Code Here

      return retVal.toString().trim();
   }

   public static XSAttributeUse searchForAttributeUse(XSElementDeclaration descriptor, String attrName)
   {
      XSComplexTypeDefinition def = getComplexTypeDef(descriptor);
      if (def == null)
      {
         return null;
      }
      XSObjectList l = def.getAttributeUses();
      for (int i=0; i < l.getLength(); ++i)
      {
         XSAttributeUse use = (XSAttributeUse)l.item(i);
         if (attrName.equals(use.getAttrDeclaration().getName()))
         {
View Full Code Here

      return false;
   }
  
   static public XSObjectList getAttributeUses(XSElementDeclaration elemDecl)
   {
      XSComplexTypeDefinition def = XSDUtil.getComplexTypeDef(elemDecl);
     
      return def != null ? def.getAttributeUses() : null;
   }
View Full Code Here

      try
      {
         XSModel model = XSDUtil.getXSModel(XSDUtilTest.class.getResource("attributetypes.xsd"));
  
         XSElementDeclaration elemDecl = model.getElementDeclaration("Metadata", null);
         XSComplexTypeDefinition complexDecl = XSDUtil.getComplexTypeDef(elemDecl);
         XSObjectList list = complexDecl.getAttributeUses();
         XSAttributeUse attrUse = (XSAttributeUse)list.item(0);
  
         assertTrue(XSDUtil.hasPattern(attrUse.getAttrDeclaration()));     
         assertNull(XSDUtil.validate("1.8", attrUse.getAttrDeclaration()));
         assertNotNull(XSDUtil.validate("abc", attrUse.getAttrDeclaration()));
View Full Code Here

      assertTrue("Schema Annotations length > 0", xsobjlist.getLength()>0);
     
      //Test Annotation at the Complex Type Level
      XSTypeDefinition xt = xsmodel.getTypeDefinition("USAddress","http://org.jboss.ws/types");
      assertTrue("USAddress is a complex type?",xt instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xt;
      XSObjectList xo = xc.getAnnotations();
      assertTrue("There is one annotation", xo.getLength() == 1);
     
      //Test Annotation at the Global Element Level
      XSElementDeclaration xe = xsmodel.getElementDeclaration("myAddress","http://org.jboss.ws/types");
      XSAnnotation xa = xe.getAnnotation();
View Full Code Here

      xsnamedmap = getXSNamedMap(xsmodel, arrTypeNS);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObjArray", xobj.getName());
      assertTrue("HelloObjArray is a complex type?",xobj instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) xobj;
      XSModelGroupImpl sequence = (XSModelGroupImpl) complexType.getParticle().getTerm();
      XSElementDecl valueElement = (XSElementDecl) ((XSParticleDecl) sequence.getParticles().item(0)).getTerm();
      String name = valueElement.getTypeDefinition().getName();

      assertEquals("HelloObj", name);

      //Test the case when the schema files are parsed one by one
      XSModel newxsmodel = utils.parseSchema("resources/tools/wsdlfixture/customtype/CustomTypeObj.xsd");
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

      newxsmodel = utils.parseSchema("resources/tools/wsdlfixture/customtype/CustomTypeArrays.xsd");
      assertNotNull("XSModel is null?", newxsmodel);
      xsnamedmap = getXSNamedMap(newxsmodel, arrTypeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObjArray", xobj.getName());
      assertTrue("HelloObjArray is a complex type?",xobj instanceof XSComplexTypeDefinition);
      assertTrue("HelloObjArray is not a Wild Card?",!(xobj instanceof XSWildcard));
      XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xobj;
      XSParticle xspart =  xc.getParticle();
      assertNotNull("Particle is null?",xspart);
      XSTerm xsterm = xspart.getTerm();
      assertNotNull("XSTerm is null?",xsterm);
      assertTrue("XSTerm is a model group",xsterm instanceof XSModelGroup);
      XSModelGroup xm = (XSModelGroup)xsterm;
View Full Code Here

      xsnamedmap = getXSNamedMap(xsmodel, arrTypeNS);
      assertEquals(1, xsnamedmap.getLength());
      xobj = xsnamedmap.item(0);
      assertEquals("HelloObjArray", xobj.getName());
      assertTrue("HelloObjArray is a complex type?",xobj instanceof XSComplexTypeDefinition);
      XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) xobj;
      XSModelGroupImpl sequence = (XSModelGroupImpl) complexType.getParticle().getTerm();
      XSElementDecl valueElement = (XSElementDecl) ((XSParticleDecl) sequence.getParticles().item(0)).getTerm();
      String name = valueElement.getTypeDefinition().getName();

      //System.out.println("FIXME: JBWS-357");
      assertEquals("HelloObj", name);
View Full Code Here

                     + x1.getName() + ":" + x2.getName());
      //TODO: Expand comparison of types to include attributes/elements
      if(x1 instanceof XSComplexTypeDefinition &&
            x2 instanceof XSComplexTypeDefinition)
      {
         XSComplexTypeDefinition xc1 = (XSComplexTypeDefinition) x1;
         XSComplexTypeDefinition xc2 = (XSComplexTypeDefinition) x2;
         bool = validateXSComplexTypeDefinitions(xc1, xc2);
      }
      return bool;
   }
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.