Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSObject


                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


            {
               XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
               String roots = "";
               for(int j = 0; j < components.getLength(); ++j)
               {
                  XSObject xsObject = components.item(j);
                  if(j > 0)
                  {
                     roots += ", ";
                  }
                  roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName();
               }
               throw new IllegalStateException("Root element not found: " + qName + " among " + roots);
            }

            Object o = provider.getRoot(root, null, element.getNamespace(), element.getName());
View Full Code Here

         {
            List typeNames = new ArrayList();
            XSNamedMap types = model.getComponents(XSConstants.TYPE_DEFINITION);
            for(int i = 0; i < types.getLength(); ++i)
            {
               XSObject type = types.item(i);
               if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace()))
               {
                  typeNames.add(new QName(type.getNamespace(), type.getName()));
               }
            }
            throw new JBossXBRuntimeException("Type " +
               mapping.typeName +
               " is not defined in the schema." +
View Full Code Here

    public final void testGetChild() {
        XSObject[] expectedChildren = new XSObject[] { model.getTypeDefinition("anySimpleType", "http://www.w3.org/2001/XMLSchema"), model.getTypeDefinition("string", "http://www.w3.org/2001/XMLSchema"),
                model.getTypeDefinition("childchild", "http://mindcrime-ilab.de/xsdanalyzer/test/typeHierarchy"), model.getTypeDefinition("child", "http://mindcrime-ilab.de/xsdanalyzer/test/typeHierarchy"),
                model.getTypeDefinition("root", "http://mindcrime-ilab.de/xsdanalyzer/test/typeHierarchy"), null};

        XSObject parent = (XSObject) testee.getRoot();
        XSObject child = null;
        int i = 0;
        while (null != (child = (XSObject) testee.getChild(parent, 0))) {
            Assert.assertEquals(expectedChildren[++i], child);
            Assert.assertNull(testee.getChild(parent, 1));
            parent = child;
View Full Code Here

    /**
     * Test method for {@link de.mindcrimeilab.xsanalyzer.model.TypeHierarchyTreeModelAdapter#getRoot()}.
     */
    @Test
    public final void testGetRoot() {
        XSObject expectedRoot = model.getTypeDefinition("anySimpleType", "http://www.w3.org/2001/XMLSchema");
        XSObject root = (XSObject) testee.getRoot();
        Assert.assertEquals(expectedRoot, root);
    }
View Full Code Here

        Collection<? extends XSObjectList> values = similarTypes.values();
        Assert.assertNotNull(values);
        Assert.assertEquals(1, values.size());
        XSObjectList xsoList = values.iterator().next();
        Assert.assertEquals(2, xsoList.getLength());
        XSObject obj1 = xsoList.item(0);
        XSObject obj2 = xsoList.item(1);

        Assert.assertNotNull(obj1);
        Assert.assertNotNull(obj2);

        XSObject expectedObject1 = model.getTypeDefinition("similarType1", "http://mindcrime-ilab.de/xsdanalyzer/test/simpleSimilarTypesLength");
        XSObject expectedObject2 = model.getTypeDefinition("similarType2", "http://mindcrime-ilab.de/xsdanalyzer/test/simpleSimilarTypesLength");

        if (expectedObject1.equals(obj1)) {
            Assert.assertEquals(expectedObject1, obj1);
            Assert.assertEquals(expectedObject2, obj2);
        }
View Full Code Here

     * @param xsoList
     * @param expectedResult
     */
    private void checkXSObjectList(XSObjectList xsoList, List<XSObject> expectedResult) {
        for (int i = 0; i < xsoList.getLength(); ++i) {
            XSObject obj = xsoList.item(i);
            if (!expectedResult.contains(obj)) {
                Assert.fail("Found unexpected similar type [" + obj + "]");
            }
            Assert.assertTrue(expectedResult.remove(obj));
        }
View Full Code Here

      //Now that we have the schema, lets build the types for the schema
      XSNamedMap xsnamedmap = xsmodel.getComponents(XSConstants.TYPE_DEFINITION);
      int len = xsnamedmap != null ? xsnamedmap.getLength() : 0;
      for (int i = 0; i < len; i++)
      {
         XSObject type = xsnamedmap.item(i);
         if (type instanceof XSComplexTypeDefinition)
         {
            XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)type;
            //Ignore xsd:anyType
            String nsuri = type.getNamespace();
            String tname = type.getName();
            if (Constants.NS_SCHEMA_XSD.equals(nsuri) && "anyType".equals(tname)) continue;
            xsdJava.createJavaFile(ctype, dirloc.getPath(), packageName, xsmodel);
         }
         else if (type instanceof XSSimpleTypeDefinition)
         {
            XSSimpleTypeDefinition stype = (XSSimpleTypeDefinition)type;
            //Ignore xsd:anyType
            String nsuri = type.getNamespace();
            String tname = type.getName();
            if (Constants.NS_SCHEMA_XSD.equals(nsuri) && "anyType".equals(tname)) continue;
            xsdJava.createJavaFile(stype, dirloc.getPath(), packageName, xsmodel);
         }
      }
View Full Code Here

            {
               XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION);
               String roots = "";
               for(int j = 0; j < components.getLength(); ++j)
               {
                  XSObject xsObject = components.item(j);
                  if(j > 0)
                  {
                     roots += ", ";
                  }
                  roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName();
               }
               throw new IllegalStateException("Root element not found: " + qName + " among " + roots);
            }

            Object o = provider.getRoot(root, null, element.getNamespace(), element.getName());
View Full Code Here

         {
            List typeNames = new ArrayList();
            XSNamedMap types = model.getComponents(XSConstants.TYPE_DEFINITION);
            for(int i = 0; i < types.getLength(); ++i)
            {
               XSObject type = types.item(i);
               if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace()))
               {
                  typeNames.add(new QName(type.getNamespace(), type.getName()));
               }
            }
            throw new JBossXBRuntimeException("Type " +
               mapping.typeName +
               " is not defined in the schema." +
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.