Package org.apache.ws.jaxme.xs

Examples of org.apache.ws.jaxme.xs.XSSchema


    }
    return new JAXBJavaType[0];
  }

  public XsQName[] getTypesafeEnumBase(SchemaSG pController) {
    XSSchema schema = getXSSchema();
    if (schema instanceof JAXBSchema) {
      JAXBSchema jaxbSchema = (JAXBSchema) schema;
      JAXBGlobalBindings globalBindings = jaxbSchema.getJAXBGlobalBindings();
      if (globalBindings != null) {
        return globalBindings.getTypesafeEnumBase();
View Full Code Here


 
  /** <p>Redefines the given {@link XsRedefinable}.</p>
   */
  protected void redefine(XsESchema pSyntaxSchema,
      XsERedefine pRedefine, XsRedefinable pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsTAttributeGroup) {
      XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
      mySchema.redefine(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTNamedGroup) {
      XsTNamedGroup group = (XsTNamedGroup) pChild;
      mySchema.redefine(factory.newXSGroup(mySchema, group));
    } else if (pChild instanceof XsETopLevelSimpleType) {
      XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
      mySchema.redefine(factory.newXSType(mySchema, type));
    } else if (pChild instanceof XsTComplexType) {
      XsTComplexType type = (XsTComplexType) pChild;
      mySchema.redefine(factory.newXSType(mySchema, type));
    } else {
      Locator locator = (pChild instanceof XsObject) ? ((XsObject) pChild).getLocator() : pRedefine.getLocator();
      throw new LocSAXException("Unknown type for redefinition: " + pChild.getClass().getName() +
          ", perhaps you should handle this in a subclass?", locator);
    }
View Full Code Here

 
  /** <p>Adds the given object to the schema.</p>
   *
   */
  protected void add(XsESchema pSyntaxSchema, Object pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsEAnnotation) {
      XsEAnnotation annotation = (XsEAnnotation) pChild;
      mySchema.add(factory.newXSAnnotation(mySchema, annotation));
    } else if (pChild instanceof XsETopLevelSimpleType) {
      XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
      mySchema.add(factory.newXSType(mySchema, type));
    } else if (pChild instanceof XsTComplexType) {
      XsTComplexType type = (XsTComplexType) pChild;
      mySchema.add(factory.newXSType(mySchema, type));
    } else if (pChild instanceof XsTNamedGroup) {
      XsTNamedGroup group = (XsTNamedGroup) pChild;
      mySchema.add(factory.newXSGroup(mySchema, group));
    } else if (pChild instanceof XsTAttributeGroup) {
      XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
      mySchema.add(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTTopLevelElement) {
      XsTTopLevelElement element = (XsTTopLevelElement) pChild;
      mySchema.add(factory.newXSElement(mySchema, element));
    } else if (pChild instanceof XsTAttribute) {
      XsTAttribute attribute = (XsTAttribute) pChild;
      mySchema.add(factory.newXSAttribute(mySchema, attribute));
    } else if (pChild instanceof XsENotation) {
      XsENotation notation = (XsENotation) pChild;
      mySchema.add(factory.newXSNotation(mySchema, notation));
    } else {
      Locator locator = (pChild instanceof XsObject) ?
          ((XsObject) pChild).getLocator() : pSyntaxSchema.getLocator();
          throw new LocSAXException("Unknown child type: " + pChild.getClass().getName() +
              ", perhaps you should handle this in a subclass?", locator);
View Full Code Here

        context.setXsObjectFactory(xsObjectFactory);
        clearSyntaxSchemas();
        XsESchema syntaxSchema = new XsESchemaImpl(context){
        };
        parse(syntaxSchema, pInputSource);
        XSSchema schema = context.getXSObjectFactory().newXSSchema(context, syntaxSchema);
        setSchema(schema);
    parse(syntaxSchema, pInputSource.getSystemId());
    schema.validate();
        return schema;
    }
View Full Code Here

    XSContext data = parser.getData();
    data.setCurrentContentHandler(null);

    try {
      parser.parse(syntaxSchema, systemId);
      XSSchema mySchema = parser.getSchema();
      parser.createSubstitutionGroups(mySchema);
      mySchema.validate();
      finished = true;
    } catch (IOException e) {
      throw new SAXException(e);
    } catch (ParserConfigurationException e) {
      throw new SAXException(e);
View Full Code Here

      InputSource isource = new InputSource(new StringReader(schemaSpec));
      isource.setSystemId("jira46.xsd");
      JAXBSchemaReader r = getSchemaReader();
      XSParser parser = r.getSGFactory().newXSParser();
      parser.setValidating(false);
      XSSchema schema = parser.parse(isource);
      XSAttribute[] attrs = schema.getAttributes();
      assertEquals(1, attrs.length);
      XSAttribute idAttr = attrs[0];
      assertTrue(idAttr instanceof JAXBAttribute);
      assertEquals(new XsQName(uri, "id"), idAttr.getName());
      assertEquals(XSID.getInstance(), idAttr.getType());
      assertTrue(idAttr.isOptional());
      XSElement[] elements = schema.getElements();
      assertEquals(1, elements.length);
      XSElement rifElem = elements[0];
      assertFalse(rifElem.getType().isSimple());
      XSComplexType ct = rifElem.getType().getComplexType();
      XSAttributable[] rifAttrs = ct.getAttributes();
View Full Code Here

      "  </xs:simpleType>\n" +
      "</xs:schema>\n";
   
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testSimpleTypes.xsd");
    XSSchema schema = pParser.parse(isource);
   
    XSType[] types = schema.getTypes();
    assertEquals(3, types.length);
   
    XSType t1 = types[0];
    assertEquals(new XsQName((String) null, "a"), t1.getName());
    XSSimpleType st1 = assertSimpleType(t1);
View Full Code Here

      "  <xs:attribute name='c' type='xs:int'/>\n" +
      "</xs:schema>\n";

    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testAttributes.xsd");
    XSSchema schema = pParser.parse(isource);

    XSAttributable[] attr = schema.getAttributes();
    assertEquals(3, attr.length);

    XSAttribute attr1 = (XSAttribute) attr[0];
    assertTrue(attr1.isGlobal());
    assertEquals(new XsQName((String) null, "a"), attr1.getName());
View Full Code Here

      "  </xs:attributeGroup>\n" +
      "</xs:schema>\n";

    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testAttributeGroups.xsd");
    XSSchema schema = pParser.parse(isource);

    XSAttributeGroup[] groups = schema.getAttributeGroups();
    assertNotNull(groups);
    assertEquals(2, groups.length);

    XSAttributeGroup ag1 = groups[0];
    assertEquals(new XsQName((String) null, "c"), ag1.getName());
View Full Code Here

      "  </xs:element>\n" +
      "</xs:schema>\n";

    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testElements.xsd");
    XSSchema schema = pParser.parse(isource);

    XSObject[] elements = schema.getElements();
    assertEquals(4, elements.length);

    XSElement e1 = (XSElement) elements[0];
    assertEquals(new XsQName((String) null, "a"), e1.getName());
    XSType t1 = e1.getType();
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.XSSchema

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.