Package org.apache.ws.jaxme.generator.sg

Examples of org.apache.ws.jaxme.generator.sg.SchemaSG


      "   </xsd:restriction> \n" +
      "  </xsd:simpleType> \n" +
      " </xsd:element> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testRestrictionMaxExclusive.xsd");
    ObjectSG[] elements = jschema.getElements();
    assertEquals(1, elements.length);
    ObjectSG quantity = elements[0];
    String maxExclusive = quantity.getTypeSG().getSimpleTypeSG().getAtomicType().getMaxExclusive();
    assertNotNull(maxExclusive);
    assertEquals("100", maxExclusive);
View Full Code Here


      "  </jaxb:schemaBindings>\n" +
      " </xsd:appinfo></xsd:annotation>\n" +
      " <xsd:element name='non-positive-integer' type='xsd:nonPositiveInteger'/> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testNonPositiveInteger.xsd");

    // simple, atomic, with restriction and maxExclusive and maxInclusive
    TypeSG npi = jschema.getElements()[0].getTypeSG();
    assertTrue(!npi.isComplex());
    SimpleTypeSG npis = npi.getSimpleTypeSG();
    assertTrue(npis.isAtomic());
    assertTrue(!npis.isList());
    assertTrue(!npis.isUnion());
View Full Code Here

      "  </jaxb:schemaBindings>\n" +
      " </xsd:appinfo></xsd:annotation>\n" +
      " <xsd:element name='negative-integer' type='xsd:negativeInteger'/> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testNegativeInteger.xsd");

    // simple, atomic, with restrictions on maxInclusive and MaxExclusive
    TypeSG ni = jschema.getElements()[0].getTypeSG();
    assertTrue(!ni.isComplex());
    SimpleTypeSG nis = ni.getSimpleTypeSG();
    assertTrue(nis.isAtomic());
    assertTrue(!nis.isList());
    assertTrue(!nis.isUnion());
View Full Code Here

      "  </jaxb:schemaBindings>\n" +
      " </xsd:appinfo></xsd:annotation>\n" +
      " <xsd:element name='non-negative-integer' type='xsd:nonNegativeInteger'/> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testNonNegativeIntegerType.xsd");

    // simple, atomic, with restriction on minInclusive and minExclusive
    TypeSG nni = jschema.getElements()[0].getTypeSG();
    assertTrue(!nni.isComplex());
    SimpleTypeSG nnis = nni.getSimpleTypeSG();
    assertTrue(nnis.isAtomic());
    assertTrue(!nnis.isList());
    assertTrue(!nnis.isUnion());
View Full Code Here

      "  </jaxb:schemaBindings>\n" +
      " </xsd:appinfo></xsd:annotation>\n" +
      " <xsd:element name='positive-integer' type='xsd:positiveInteger'/> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testPositiveIntegerType.xsd");

    // simple, atomic, with restriction on minInclusive and minExclusive
    TypeSG pi = jschema.getElements()[0].getTypeSG();
    assertTrue(!pi.isComplex());
    SimpleTypeSG pis = pi.getSimpleTypeSG();
    assertTrue(pis.isAtomic());
    assertTrue(!pis.isList());
    assertTrue(!pis.isUnion());
View Full Code Here

      "  </jaxb:schemaBindings>\n" +
      " </xsd:appinfo></xsd:annotation>\n" +
      " <xsd:element name='integer' type='xsd:integer'/> \n" +
      "</xsd:schema> \n";

    SchemaSG jschema = parse(schema, "testIntegerType.xsd");

    // simple, atomic, with restriction on fractionDigits
    ObjectSG[] elements = jschema.getElements();
    TypeSG i = elements[0].getTypeSG();
    assertTrue(!i.isComplex());
    SimpleTypeSG is = i.getSimpleTypeSG();
    assertTrue(is.isAtomic());
    assertTrue(!is.isList());
View Full Code Here

      "  </jaxb:schemaBindings>\n" +
      " </xs:appinfo></xs:annotation>\n" +
      " <xs:element name='some-nmtokens' type='xs:NMTOKENS'/> \n" +
      "</xs:schema> \n";

    SchemaSG jschema = parse(schema, "testNmTokensType.xsd");

    // list of one or more nmtoken's
    ObjectSG[] elements = jschema.getElements();
    assertEquals(1, elements.length);
    TypeSG nmts = elements[0].getTypeSG();
    assertTrue(!nmts.isComplex());
    SimpleTypeSG nmtss = nmts.getSimpleTypeSG();
    assertTrue(!nmtss.isAtomic());
View Full Code Here

            generator.setTargetDirectory(outputDir);
            generator.setForcingOverwrite(false);
            generator.setSchemaReader(reader);

            for (int i = 0; i < xmlObjectsVector.size(); i++) {
                SchemaSG sg = generator.generate((InputSource)xmlObjectsVector.elementAt(i));
                ObjectSG[] elements = sg.getElements();
                for (int j = 0; j < elements.length; j++) {
                    XsQName qName = elements[j].getName();
                    JavaQName name = elements[j].getClassContext().getXMLInterfaceName();
                    mapper.addTypeMappingName(
                            new QName(qName.getNamespaceURI(), qName.getLocalName()),
                            name.getPackageName() + '.' + name.getClassName());
                }
                TypeSG[] types = sg.getTypes();
                for (int j = 0; j < types.length; j++) {
                    XsQName qName = types[j].getName();
                    JavaQName name = types[j].getRuntimeType();
                    mapper.addTypeMappingName(
                            new QName(qName.getNamespaceURI(), qName.getLocalName()),
                            name.getPackageName() + '.' + name.getClassName());
                }
                GroupSG[] groups = sg.getGroups();
                for (int j = 0; j < groups.length; j++) {
                    XsQName qName = groups[j].getName();
                    JavaQName name = groups[j].getClassContext().getXMLInterfaceName();
                    mapper.addTypeMappingName(
                            new QName(qName.getNamespaceURI(), qName.getLocalName()),
View Full Code Here

      + "</xs:schema>\n";
    Generator g = new GeneratorImpl();
    SchemaReader sr = new JAXBSchemaReader();
    g.setSchemaReader(sr);
    sr.setGenerator(g);
    SchemaSG schema = g.getSchemaReader().parse(new InputSource(new StringReader(xsSchema)));
    assertEquals("Element1", JavaNamer.convert("element1", schema));
    assertEquals("Element_1", JavaNamer.convert("element_1", schema));
  }
View Full Code Here

      }

      for (int i = 0;  i < schemaFiles.length;  i++) {
        log("Reading schema file " + schemaFiles[i], Project.MSG_VERBOSE);
        try {
      SchemaSG schemaSG = generator.generate(schemaFiles[i]);
          if (producesFilesSet != null) {
            JavaSourceFactory jsf = schemaSG.getJavaSourceFactory();
            File targetDirectory = getTarget();
            for (Iterator iter = jsf.getJavaSources();  iter.hasNext()) {
              JavaSource js = (JavaSource) iter.next();
              File f = jsf.getLocation(targetDirectory, js).getAbsoluteFile();
              producesFilesSet.remove(f);
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.generator.sg.SchemaSG

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.