Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSObject


      assertNotNull("XSModel is null?", xsmodel);

      XSNamedMap xsnamedmap = getXSNamedMap(xsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      XSObject xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

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


      assertNotNull("XSModel is null?", xsmodel);

      XSNamedMap xsnamedmap = getXSNamedMap(xsmodel, typeNS);
      assertNotNull("XSNamedMap is null?", xsnamedmap);
      assertEquals(1, xsnamedmap.getLength());
      XSObject xobj = xsnamedmap.item(0);
      assertEquals("HelloObj", xobj.getName());
      assertTrue("HelloObj is a complex type?",xobj instanceof XSComplexTypeDefinition);

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

      assertTrue("Does Schema file exist?", xsdFile.exists());
      XSModel xsmodel = parseSchema(xsdFile.toURL());
      assertNotNull("XSModel is null?", xsmodel);
      XSNamedMap xsmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION, "http://org.jboss.ws/types");
      assertNotNull("XSNamedMap is null?", xsmap);
      XSObject xsobj = xsmap.itemByName("http://org.jboss.ws/types", "USAddress");
      assertNotNull("Is XSObject null?", xsobj);
   }
View Full Code Here

      schemaMap.put("http://org.jboss.ws/types2", new File("resources/tools/xsd/schemaimport/SchemaImport.xsd").toURL());
      XSModel xsmodel = parseSchema(schemaMap);
      assertNotNull("XSModel is null?", xsmodel);
      XSNamedMap xsmap = xsmodel.getComponentsByNamespace(XSConstants.TYPE_DEFINITION, "http://org.jboss.ws/types2");
      assertNotNull("XSNamedMap is null?", xsmap);
      XSObject xsobj = xsmap.itemByName("http://org.jboss.ws/types2", "USAddress");
      assertNotNull("Is XSObject null?", xsobj);
   }
View Full Code Here

                                            maxOccurs);
        }
       
        XSObjectList compositorChildren = modelGroup.getParticles();
        for (int seqIdx = 0; seqIdx < compositorChildren.getLength(); seqIdx++) {
            XSObject seqItem = compositorChildren.item(seqIdx);
            XSParticle compositorParticle = (XSParticle) seqItem;
            String minOccursParticle = getMinOccursVal(compositorParticle);
            String maxOccursParticle = getMaxOccursVal(compositorParticle);
            XSTerm partclTerm = compositorParticle.getTerm();           
            if (partclTerm instanceof XSElementDeclaration) {
View Full Code Here

                if (map.getLength() != 0) {
          System.out.println("*************************************************");
          System.out.println("* Global element declarations: {namespace} name ");
          System.out.println("*************************************************");
                    for (int i = 0; i < map.getLength(); i++) {
                        XSObject item = map.item(i);
                        System.out.println("{" + item.getNamespace() + "}" + item.getName());
                    }
                }
                // attribute declarations
                map = model.getComponents(XSConstants.ATTRIBUTE_DECLARATION);
                if (map.getLength() != 0) {
          System.out.println("*************************************************");
                    System.out.println("* Global attribute declarations: {namespace} name");
          System.out.println("*************************************************");
                    for (int i = 0; i < map.getLength(); i++) {
                        XSObject item = map.item(i);
                        System.out.println("{" + item.getNamespace() + "}" + item.getName());
                    }
                }
        // notation declarations
        map = model.getComponents(XSConstants.TYPE_DEFINITION);
        if (map.getLength() != 0) {
          System.out.println("*************************************************");
          System.out.println("* Global type declarations: {namespace} name");
          System.out.println("*************************************************");
          for (int i = 0; i < map.getLength(); i++) {
            XSObject item = map.item(i);
            System.out.println("{" + item.getNamespace() + "}" + item.getName());
          }
        }
               
        // notation declarations
        map = model.getComponents(XSConstants.NOTATION_DECLARATION);
        if (map.getLength() != 0) {
          System.out.println("*************************************************");
          System.out.println("* Global notation declarations: {namespace} name");
          System.out.println("*************************************************");
          for (int i = 0; i < map.getLength(); i++) {
            XSObject item = map.item(i);
            System.out.println("{" + item.getNamespace() + "}" + item.getName());
          }
        }

            }

View Full Code Here

            nameAtt = fSymbolTable.addSymbol(nameAtt);
       
        // get 'target namespace'
        String tnsAtt = null;
        XSComplexTypeDecl enclCT = null;
        XSObject enclParent = null;
        short scope = XSAttributeDecl.SCOPE_ABSENT;
        if (isGlobal) {
            tnsAtt = schemaDoc.fTargetNamespace;
            scope = XSAttributeDecl.SCOPE_GLOBAL;
        }
View Full Code Here

            term((XSObject)currentComponents.get(i), XSConstants.MODEL_GROUP, SCDParser.WILDCARD, currentComponents);
        }

        switch (sourceComponent.getType()) {
        case XSConstants.ELEMENT_DECLARATION: {
            XSObject typeDef = ((XSElementDeclaration)sourceComponent).getTypeDefinition();
            if (typeDef != null && !currentComponents.contains(typeDef)) {
                currentComponents.add(typeDef);
            }
        }
        break;
        case XSConstants.ATTRIBUTE_DECLARATION: {
            XSObject typeDef = ((XSAttributeDeclaration)sourceComponent).getTypeDefinition();
            if (typeDef != null && !currentComponents.contains(typeDef)) {
                currentComponents.add(typeDef);
            }
        }
        break;
View Full Code Here

                term((XSObject)currentComponents.get(i), XSConstants.MODEL_GROUP, step.getNametest(), result);
            }
            break;
        case Axis.ANY_ATTRIBUTE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                XSObject comp = ((XSObject)currentComponents.get(i));
                short type = comp.getType();
                if (type == XSConstants.TYPE_DEFINITION) {
                    type = ((XSTypeDefinition)comp).getTypeCategory();
                    if (type == XSTypeDefinition.COMPLEX_TYPE) {
                        addComponent(((XSComplexTypeDefinition)comp).getAttributeWildcard(),
                                step.getNametest(), result);
                    }

                } else if (type == XSConstants.ATTRIBUTE_GROUP) {
                    addComponent(((XSAttributeGroupDefinition)comp).getAttributeWildcard(),
                            step.getNametest(), result);
                }
            }
            break;
        case Axis.ANY:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                term((XSObject)currentComponents.get(i), XSConstants.WILDCARD, step.getNametest(), result);
            }
            break;
        case Axis.FACET: // we are returning the part of thefacets. a limitation
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                componentLinked((XSObject)currentComponents.get(i), XSConstants.FACET, step.getNametest(), result);
            }
            break;
        case Axis.SCOPE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                componentScope((XSObject)currentComponents.get(i), result);
            }
            break;
        case Axis.CONTEXT:
            // TODO: we do not support this yet. is Schema 1.1
            throw new SCDException("Error in SCD: Context axis is not supported");
            //break;
        case Axis.SUBSTITUTION_GROUP:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                XSObject comp = (XSObject)currentComponents.get(i);
                if (comp.getType() == XSConstants.ELEMENT_DECLARATION) {
                    addComponent(((XSElementDeclaration)comp).getSubstitutionGroupAffiliation(),
                            step.getNametest(), result);
                }
            }
            break;
        case Axis.BASE_TYPE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                if (((XSObject)currentComponents.get(i)).getType() == XSConstants.TYPE_DEFINITION) {
                    addComponent((((XSTypeDefinition)currentComponents.get(i))).getBaseType(),
                            step.getNametest(), result);
                }
            }
            break;
        case Axis.ITEM_TYPE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                if (((XSObject)currentComponents.get(i)).getType() == XSConstants.TYPE_DEFINITION) {
                    XSObject comp = (XSObject)currentComponents.get(i);
                    if (((XSTypeDefinition)comp).getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                        addComponent(((XSSimpleTypeDefinition)comp).getItemType(),
                                step.getNametest(), result);
                    }
                }
            }
            break;
        case Axis.MEMBER_TYPE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                if (((XSObject)currentComponents.get(i)).getType() == XSConstants.TYPE_DEFINITION) {
                    XSObject comp = (XSObject)currentComponents.get(i);
                    if (((XSTypeDefinition)comp).getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                        XSObjectList memberTypes = ((XSSimpleTypeDefinition)comp).getMemberTypes();
                        for (int j = 0, nt = memberTypes.size(); j < nt; ++j) {
                            addComponent((XSObject)memberTypes.get(j), step.getNametest(), result);
                        }
                    }
                }
            }
            break;
        case Axis.PRIMITIVE_TYPE:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                if (((XSObject)currentComponents.get(i)).getType() == XSConstants.TYPE_DEFINITION) {
                    XSObject comp = (XSObject)currentComponents.get(i);
                    if (((XSTypeDefinition)comp).getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                        addComponent(((XSSimpleTypeDefinition)comp).getPrimitiveType(),
                                step.getNametest(), result);
                    }
                }
            }
            break;
        case Axis.KEY:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                if (((XSObject)currentComponents.get(i)).getType() == XSConstants.IDENTITY_CONSTRAINT) {
                    addComponent(((XSIDCDefinition)currentComponents.get(i)).getRefKey(),
                            step.getNametest(), result);
                }
            }
            break;
        case Axis.ANNOTATION:
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                annotations((XSObject)currentComponents.get(i), result);
            }
            break;
        case Axis.ATTRIBUTE_USE: {
            XSObjectList attribUses = null;
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                XSObject comp = (XSObject)currentComponents.get(i);
                if (comp.getType() == XSConstants.TYPE_DEFINITION) {
                    if (((XSTypeDefinition)comp).getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
                        attribUses = ((XSComplexTypeDefinition)comp).getAttributeUses();
                    }
                } else if (comp.getType() == XSConstants.ATTRIBUTE_GROUP) {
                    attribUses = ((XSAttributeGroupDefinition)comp).getAttributeUses();
                }
                if (attribUses != null) {
                    for (int j = 0, na = attribUses.size(); j < na; ++j) {
                        addComponent((XSObject)attribUses.get(j),
                                step.getNametest(), result);
                    }
                }
            }
        }
        break;
        case Axis.PARTICLE: {
            for (int i = 0, n = currentComponents.size(); i < n; ++i) {
                XSObject comp = (XSObject)currentComponents.get(i);
                if (comp.getType() == XSConstants.MODEL_GROUP) {
                    XSObjectList particles = ((XSModelGroup)comp).getParticles();
                    for (int j = 0, np = particles.size(); j < np; ++j) {
                        addComponent((XSObject) particles.get(j),
                                step.getNametest(), result);
                    }
View Full Code Here

    private void applyPredicate(int predicate) throws SCDException {
        if (predicate == 0) {
            return;
        } else if (predicate > 0 && predicate <= result.size()) {
            XSObject component = (XSObject)result.get(predicate - 1);
            result.clear();
            result.add(component);
        } else {
            throw new SCDException("Error in SCD: Invalid predicate value ("
                    + predicate + ") detected");
View Full Code Here

TOP

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

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.