Package org.apache.ws.jaxme.xs.jaxb.impl

Examples of org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser


      "      <xs:element ref='ns:head'/>\n" +
      "    </xs:sequence>\n" +
      "  </xs:complexType>\n" +
      "</xs:schema>\n";
   
    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource1));
    isource.setSystemId("testTargetNamespace1.xsd");
    XSSchema schema = parser.parse(isource);
    XSElement[] elements = schema.getElements();
    assertEquals(3, elements.length);
    XsQName headName = new XsQName("http://test.com/namespaces", "head");
    XsQName subst1Name = new XsQName("http://test.com/namespaces", "subst1");
    XsQName subst2Name = new XsQName("http://test.com/namespaces", "subst2");
View Full Code Here


    // settings.
    final String schemaSource =
      "<?xml version='1.0'?>\n" +
      "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'/>\n";
   
    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testGlobalBindingsDefaults.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    JAXBGlobalBindings globalBindings = schema.getJAXBGlobalBindings();
    String collectionType = globalBindings.getCollectionType();
    assertNull(collectionType);
    JAXBJavaType[] javaTypes = globalBindings.getJavaType();
    assertNotNull(javaTypes);
View Full Code Here

      "          underscoreBinding='asCharInWord'/>\n" +
      "    </xs:appinfo\n>" +
      "  </xs:annotation>\n" +
      "</xs:schema>";
   
    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testGlobalBindingsDefaults.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    JAXBGlobalBindings globalBindings = schema.getJAXBGlobalBindings();
    String collectionType = globalBindings.getCollectionType();
    assertEquals("java.util.ArrayList", collectionType);
 
    XsQName[] typesafeEnumBase = globalBindings.getTypesafeEnumBase();
View Full Code Here

      "      <xs:element name='b' type='xs:string'/>\n" +
      "    </xs:sequence>\n" +
      "  </xs:complexType>\n" +
      "</xs:schema>";
   
    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testSchemaBindingsDefaults.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
    assertNotNull(a);
    assertComplexType(a);
 
    JAXBSchemaBindings schemaBindings = a.getJAXBSchemaBindings();
View Full Code Here

      "    <xs:attribute name='y' type='xs:string'/>\n" +
      "  </xs:complexType>\n" +
      "  <xs:element name='b' type='a'/>\n" +
      "</xs:schema>";
   
    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testSchemaBindings.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
    JAXBSchemaBindings schemaBindings = a.getJAXBSchemaBindings();
 
    JAXBSchemaBindings.Package schemaPackage = schemaBindings.getPackage();
    assertNotNull(schemaPackage);
View Full Code Here

        "      <xs:element name='n' type='xs:float'/>\n" +
        "    </xs:sequence>\n" +
        "  </xs:group>\n" +
        "</xs:schema>";
 
      JAXBParser parser = newJAXBParser();
      InputSource isource = new InputSource(new StringReader(schemaSource));
      isource.setSystemId("testClass1.xsd");
      JAXBSchema schema = (JAXBSchema) parser.parse(isource);
      JAXBType a = (JAXBType) schema.getType(new XsQName((String) null, "a"));
      assertNotNull(a);
      JAXBClass jaxbClass = a.getJAXBClass();
      assertNotNull(jaxbClass);
      assertEquals("b", jaxbClass.getName());
      assertEquals("com.b.c", jaxbClass.getImplClass());
      XSParticle p1 = assertComplexContent(assertComplexType(a));
      XSGroup group = assertGroup(p1);
      XSParticle[] particles = group.getParticles();
      assertEquals(2, particles.length);
      JAXBElement f = (JAXBElement) assertElement(particles[1]);
      jaxbClass = f.getJAXBClass();
      assertNotNull(jaxbClass);
      assertEquals("x", jaxbClass.getName());
      assertNull(jaxbClass.getImplClass());


      JAXBElement g = (JAXBElement) schema.getElement(new XsQName((String) null, "g"));
      assertNotNull(g);
      assertNull(g.getJAXBClass());

      JAXBGroup m = (JAXBGroup) schema.getGroup(new XsQName((String) null, "m"));
      jaxbClass = m.getJAXBClass();
      assertNotNull(jaxbClass);
      assertEquals("k", jaxbClass.getName());
      assertEquals("com.b.i", jaxbClass.getImplClass());
    }

    {
      final String schemaSource =
        "<?xml version='1.0'?>\n" +
        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
        "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
        "  <xs:complexType name='d'>\n" +
        "    <xs:sequence>\n" +
        "      <xs:element name='e'>\n" +
        "        <xs:complexType name='a'>\n" +
        "          <xs:annotation>\n" +
        "            <xs:appinfo>\n" +
        "              <jaxb:class name='b'/>\n" +
        "            </xs:appinfo>\n" +
        "          </xs:annotation>\n" +
        "          <xs:sequence>\n" +
        "            <xs:element name='x' type='xs:int'/>\n" +
        "          </xs:sequence>\n" +
        "          <xs:attribute name='y' type='xs:string'/>\n" +
        "        </xs:complexType>\n" +
        "      </xs:element>\n" +
        "      <xs:element name='f' type='xs:string'>\n" +
        "        <xs:annotation>\n" +
        "          <xs:appinfo>\n" +
        "            <jaxb:class name='x'/>\n" +
        "          </xs:appinfo>\n" +
        "        </xs:annotation>\n" +
        "      </xs:element>\n" +
        "      <xs:element name='g' type='xs:string'/>\n" +
        "    </xs:sequence>\n" +
        "  </xs:complexType>\n" +
        "</xs:schema>";
 
      JAXBParser parser = newJAXBParser();
      InputSource isource = new InputSource(new StringReader(schemaSource));
      isource.setSystemId("testJAXBClass2.xsd");
      JAXBSchema schema = (JAXBSchema) parser.parse(isource);
      JAXBType d = (JAXBType) schema.getType(new XsQName((String) null, "d"));
      assertNotNull(d);
      XSGroup dGroup = assertGroup(assertComplexContent(assertComplexType(d)));
      assertSequence(dGroup);
      XSParticle[] particles = dGroup.getParticles();
      assertEquals(3, particles.length);
      JAXBElement e = (JAXBElement) assertElement(particles[0]);
      JAXBType a = (JAXBType) e.getType();
      JAXBClass jaxbClass = a.getJAXBClass();
      assertNotNull(jaxbClass);
      assertEquals("b", jaxbClass.getName());
      assertNull(jaxbClass.getImplClass());

      JAXBElement f = (JAXBElement) assertElement(particles[1]);
      assertEquals(new XsQName((String) null, "f"), f.getName());
      assertNotNull(f);
      jaxbClass = f.getJAXBClass();
      assertNotNull(jaxbClass);
      assertEquals("x", jaxbClass.getName());
      assertNull(jaxbClass.getImplClass());

      JAXBElement g = (JAXBElement) assertElement(particles[2]);
      assertEquals(new XsQName((String) null, "g"), g.getName());
      assertNotNull(g);
      assertNull(g.getJAXBClass());
    }

    {
      final String schemaSource =
        "<?xml version='1.0'?>\n" +
        "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'" +
        "           xmlns:jaxb='" + JAXBParser.JAXB_SCHEMA_URI + "'>\n" +
        "  <xs:element name='x'>\n" +
        "    <xs:annotation><xs:appinfo>\n" +
        "      <jaxb:class name='b' implClass='com.b.c'/>\n" +
        "    </xs:appinfo></xs:annotation>\n" +
        "    <xs:complexType>\n" +
        "      <xs:sequence>\n" +
        "        <xs:element name='e'>\n" +
        "          <xs:complexType>\n" +
        "            <xs:sequence>\n" +
        "              <xs:element name='x' type='xs:int'/>\n" +
        "            </xs:sequence>\n" +
        "            <xs:attribute name='y' type='xs:string'/>\n" +
        "          </xs:complexType>\n" +
        "        </xs:element>\n" +
        "      </xs:sequence>\n" +
        "    </xs:complexType>\n" +
        "  </xs:element>\n" +
        "</xs:schema>";
 
      JAXBParser parser = newJAXBParser();
      InputSource isource = new InputSource(new StringReader(schemaSource));
      isource.setSystemId("testJAXBClass3.xsd");
      boolean haveException = false;
      try {
        parser.parse(isource);
      } catch (SAXException e) {
        haveException = true;
        assertTrue(e.getMessage().indexOf("[JAXB 6.7.3.4]") >= 0);
      }
      assertTrue(haveException);
View Full Code Here

      "      </xs:appinfo></xs:annotation>\n" +
      "    </xs:attribute>" +
      "  </xs:complexType>\n" +
      "</xs:schema>\n";

    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testJAXBProperty1.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    XSType type = schema.getType(new XsQName((String) null, "ct"));
    XSComplexType complexType = assertComplexType(type);
    XSAttributable[] attributes = complexType.getAttributes();
    assertNotNull(attributes);
    assertEquals(1, attributes.length);
View Full Code Here

      "      </jaxb:property>\n" +
      "    </xs:appinfo></xs:annotation>\n" +
      "  </xs:attribute>" +
      "</xs:schema>\n";

    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testJAXBProperty2.xsd");
    boolean haveException = false;
    try {
      parser.parse(isource);
    } catch (SAXException e) {
      haveException = true;
      assertTrue(e.getMessage().indexOf("[JAXB 6.8.1.2.1]") >= 0);
    }
    assertTrue(haveException);
View Full Code Here

      "    </xs:sequence>\n" +
      "    <xs:attribute ref='a'/>\n" +
      "  </xs:complexType>\n" +
      "</xs:schema>\n";

    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testJAXBProperty1.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    XSAttributable[] outerAttr = schema.getAttributes();
    assertEquals(1, outerAttr.length);
    JAXBAttribute outerA = (JAXBAttribute) outerAttr[0];
   
    XSType ct = schema.getType(new XsQName((String) null, "ct"));
View Full Code Here

      "      <xs:restriction base='a'/>\n" +
      "    </xs:simpleType>\n" +
      "  </xs:element>\n" +
      "</xs:schema>\n";

    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testJAXBJavaType1.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    XSType a = schema.getType(new XsQName((String) null, "a"));
    JAXBSimpleType ast = (JAXBSimpleType) assertSimpleType(a);
    JAXBJavaType ajjt = ast.getJAXBJavaType();
    assertEquals("java.math.BigDecimal", ajjt.getName());
    assertEquals("javax.xml.bind.DatatypeConverter.parseInteger", ajjt.getParseMethod());
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.jaxb.impl.JAXBParser

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.