Examples of InlinedSchemaImpl


Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

    protected Schema parseSchemaInline(XMLElement schemaElement,
                                     DescriptionElement desc)
                                     throws WSDLException{

        InlinedSchemaImpl schema = new InlinedSchemaImpl();
        schema.setId(schemaElement.getAttributeValue(SchemaConstants.ATTR_ID));
        String tns = schemaElement.getAttributeValue(SchemaConstants.ATTR_TARGET_NAMESPACE);
        if(tns != null) {
            schema.setNamespace(getURI(tns));
        }

        String baseURI = desc.getDocumentBaseURI() != null ?
                         desc.getDocumentBaseURI().toString() : null;

        XmlSchema schemaDef = null;

        try {
            OMElement omSchemaElem = (OMElement)schemaElement.getSource();
            InputSource schemaSource = OMUtils.getInputSource(omSchemaElem);
            XmlSchemaCollection xsc = new XmlSchemaCollection();

            //Set the baseURI and the namespaces from the DescriptionElement in the XMLSchemaCollection
            xsc.setBaseUri(baseURI);
           
            NamespaceMap namespaces = new NamespaceMap();
            Iterator it = Arrays.asList(desc.getDeclaredNamespaces()).iterator();
            while(it.hasNext()) {
                NamespaceDeclaration d = (NamespaceDeclaration)it.next();
                namespaces.add(d.getPrefix(), d.getNamespaceURI().toString());
            }
            xsc.setNamespaceContext(namespaces);
           
            // Plug in the selected woden URI Resolver
            xsc.setSchemaResolver(new OMSchemaResolverAdapter(getURIResolver(), schemaElement));
           
            schemaDef = xsc.read(schemaSource, null);
        }
        catch (XmlSchemaException e){

            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_WARNING,
                    e);
        }
        catch (RuntimeException e)
        {
            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_ERROR,
                    e);           
        }
       
        if(schemaDef != null) {
            schema.setSchemaDefinition(schemaDef);
        }
        else {
            schema.setReferenceable(false);
        }

        return schema;
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

    protected Schema parseSchemaInline(XMLElement schemaEl,
                                     DescriptionElement desc)
                                     throws WSDLException
    {
        InlinedSchemaImpl schema = new InlinedSchemaImpl();
        schema.setXMLElement(schemaEl);
       
        schema.setId(schemaEl.getAttributeValue(SchemaConstants.ATTR_ID));
       
        String tns = schemaEl.getAttributeValue(SchemaConstants.ATTR_TARGET_NAMESPACE);
        if(tns != null) {
            schema.setNamespace(getURI(tns));
        }
       
        String baseURI = desc.getDocumentBaseURI() != null ?
                         desc.getDocumentBaseURI().toString() : null;
        XmlSchema schemaDef = null;
       
        try {
          Element domSchemaEl = (Element)schemaEl.getSource();
            XmlSchemaCollection xsc = new XmlSchemaCollection();
            xsc.setBaseUri(baseURI);
           
            // Plug in the selected woden URI Resolver
            xsc.setSchemaResolver(new DOMSchemaResolverAdapter(getURIResolver(), schemaEl));        
            schemaDef = xsc.read(domSchemaEl, baseURI);
        }
        catch (XmlSchemaException e)
        {
            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_WARNING,
                    e);
        }
        catch (RuntimeException e)
        {
            getErrorReporter().reportError(
                    new ErrorLocatorImpl()//TODO line&col nos.
                    "WSDL521",
                    new Object[] {baseURI},
                    ErrorReporter.SEVERITY_ERROR,
                    e);           
        }
       
        if(schemaDef != null) {
            schema.setSchemaDefinition(schemaDef);
        } else {
            schema.setReferenceable(false);
        }
       
        return schema;
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

  // that define the same element produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[2];
    inlinedSchemas[0]= new InlinedSchemaImpl();
    inlinedSchemas[1] = new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
    inlinedSchemas[1].setNamespace(new URI("http://www.sample.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      reader = new StringReader(schemaString);
      is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc2 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
      XmlSchemaCollection xsc2 = new XmlSchemaCollection();
      XmlSchema xs2 = xsc2.read(schemaDoc2.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    inlinedSchemas[1].setSchemaDefinition(xs2);
    if(val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was no error reported for an inline schema that declares the same element as another inline schema with the same namespace.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 

  // Test that two inline schemas with the different target namespaces
  // that define the same element do not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[2];
    inlinedSchemas[0]= new InlinedSchemaImpl();
    inlinedSchemas[1] = new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
    inlinedSchemas[1].setNamespace(new URI("http://www.sample2.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      reader = new StringReader(schemaStringNS2);
      is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc2 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
      XmlSchema xs2 = xsc.read(schemaDoc2.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    inlinedSchemas[1].setSchemaDefinition(xs2);
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema that declares the same element as another inline schema but has a different target namespace.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
    // Test that only one inline schema does not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema list that contains only one inline schema.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
  // Test that an inline schema that can not be read (that's null) does not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));

    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema list that contains a schema that couldn't be read (is null).");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
  //   Test that only one inline schema does not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema list that contains only one inline schema.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
  // Test that an inline schema with no defined target namespace doesn't produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema that contains a null namespace.");
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

  // that define the same type produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[2];
    inlinedSchemas[0]= new InlinedSchemaImpl();
    inlinedSchemas[1] = new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
    inlinedSchemas[1].setNamespace(new URI("http://www.sample.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
   
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      reader = new StringReader(schemaString);
      is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc2 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
      XmlSchemaCollection xsc2 = new XmlSchemaCollection();
      XmlSchema xs2 = xsc2.read(schemaDoc2.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    inlinedSchemas[1].setSchemaDefinition(xs2);
    if(val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was no error reported for an inline schema that declares the same type as another inline schema with the same namespace.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 

  // Test that two inline schemas with different target namespaces
  // that define the same type do not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[2];
    inlinedSchemas[0]= new InlinedSchemaImpl();
    inlinedSchemas[1] = new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
    inlinedSchemas[1].setNamespace(new URI("http://www.sample2.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      reader = new StringReader(schemaStringNS2);
      is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc2 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
      XmlSchema xs2 = xsc.read(schemaDoc2.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    inlinedSchemas[1].setSchemaDefinition(xs2);
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema that declares the same element as another inline schema but has a different target namespace.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
    // Test that only one inline schema does not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));
   
    // Create DOM representation of schema, have XmlSchema parse it.
    DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
    inlinedSchemas[0].setSchemaDefinition(xs1);
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema list that contains only one inline schema.");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(IOException e)
  {
    fail("There was a problem parsing the test inline schema document");
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
  // Test that an inline schema that can not be read (that's null) does not produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    inlinedSchemas[0].setNamespace(new URI("http://www.sample.org"));

    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema list that contains a schema that couldn't be read (is null).");
    }
  }
  catch(URISyntaxException e)
  {
    fail("There was a problem setting the namespace of the imported schema: " + e);
  }
  catch(WSDLException e)
  {
    fail("There was a problem running the test assertion method " + e);
    }
 
  // Test that an inline schema with no defined target namespace doesn't produce an error.
  handler.reset();
  try
  {
    InlinedSchema[] inlinedSchemas = new InlinedSchema[1];
    inlinedSchemas[0]= new InlinedSchemaImpl();
 
    if(!val.testAssertionSchema1073(inlinedSchemas, reporter))
    {
    fail("There was an error reported for an inline schema that contains a null namespace.");
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

    } catch (WSDLException e) {
        fail("Can't instantiate the WSDLFactory object.");
    }

  // Create a schema for use in the tests and add it to a types section.
    InlinedSchema schema = new InlinedSchemaImpl();
    XmlSchema xs1 = null;
    URI schemaNS = null;
  try
  {
      String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.sample.org\">"
              + "<complexType name=\"myType\">"    
              + "<sequence>"    
              + "<element  name=\"element\" type=\"string\"/>"     
              + "</sequence>"    
              + "</complexType>"
              + "<element name=\"myElement\" type=\"string\"/>"
              + "</schema>";
      DOMParser builder = new DOMParser();
    Reader reader = new StringReader(schemaString);
      XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
      builder.parse(is);
      Document schemaDoc1 = builder.getDocument();
      XmlSchemaCollection xsc = new XmlSchemaCollection();
      xs1 = xsc.read(schemaDoc1.getDocumentElement());
      schemaNS = new URI("http://www.sample.org");
      schema.setSchemaDefinition(xs1);
      schema.setNamespace(schemaNS);
      TypesElement types = factory.newDescription().addTypesElement();
      types.addSchema(schema);
  }
  catch(Exception e)
  {
    fail("An error occurred while creating the sample types section.");
  }
   
    // Test that a null namespace returns true.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement types = descElem.addTypesElement();
      types.addSchema(schema);
     
    if(!val.testAssertionSchema1066(descElem, null, reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a null namespace.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that a reference to a namespace that is defined inline
  // does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement types = descElem.addTypesElement();
      types.addSchema(schema);
     
    if(!val.testAssertionSchema1066(descElem, new QName("http://www.sample.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a namespace that has been defined inline.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to a namespace that is imported
  // does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement typesImported = descElem.addTypesElement();
      ImportedSchema importedSchema = new ImportedSchemaImpl();
      importedSchema.setSchemaDefinition(xs1);
      importedSchema.setNamespace(schemaNS);
      typesImported.addSchema(importedSchema);
     
    if(!val.testAssertionSchema1066(descElem, new QName("http://www.sample.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a namespace that has been imported.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to the XML Schema namespace does not return an error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      //descElem.setTypesElement(types);
     
    if(!val.testAssertionSchema1066(descElem, new QName(Constants.TYPE_XSD_2001, "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for the XML Schema namespace.");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
    // Test that a reference to a namespace that has not been defined inline or imported returns an error.
  // This test also checks that the method functions correctly with no defined types element.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      //descElem.setTypesElement(types);
     
    if(val.testAssertionSchema1066(descElem, new QName("http://www.sample2.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned true for a namespace that is not available..");
    }
  }
  catch(WSDLException e)
    {
    fail("There was a problem running the test assertion method " + e);
  }
 
  // Test that a reference to an inline schema that does not define a
  // target namespace (the targetNamespace is null) does not return an
  // error.
  handler.reset();
    try
  {
      DescriptionElement descElem = factory.newDescription();
      TypesElement typesImported = descElem.addTypesElement();
      InlinedSchema inlinedSchema = new InlinedSchemaImpl();
      typesImported.addSchema(inlinedSchema);
      InlinedSchema inlinedSchema2 = new InlinedSchemaImpl();
      inlinedSchema2.setNamespace(schemaNS);
      typesImported.addSchema(inlinedSchema2);
     
    if(!val.testAssertionSchema1066(descElem, new QName("http://www.sample.org", "myElement"), reporter))
    {
      fail("The testAssertionSchema1066 method returned false for a namespace that has been imported.");
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

    {
       return new TestSuite(SchemaTest.class);
    }
      
    public void testSetGetNamespace() {
        Schema schema = new InlinedSchemaImpl();
        URI expectedNS = URI.create("http://example.com");
        schema.setNamespace(expectedNS);
        URI actualNS = schema.getNamespace();
        assertEquals("Unexpected namespace URI", expectedNS, actualNS);
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

        Element elem = doc.getDocumentElement();
       
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        XmlSchema expectedSchemaDef = xsc.read(elem);
       
        Schema schema = new InlinedSchemaImpl();
        schema.setSchemaDefinition(expectedSchemaDef);
        XmlSchema actualSchemaDef = schema.getSchemaDefinition();
        assertEquals("Unexpected XmlSchema", expectedSchemaDef, actualSchemaDef);
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

        WSDLFactory factory = null;
        factory = WSDLFactory.newInstance();
        fDescriptionElement = factory.newDescription();
        fDescriptionElement.setTargetNamespace(URI.create(TNS));
      fTypesElement = fDescriptionElement.addTypesElement();
      fInlinedSchema1 = new InlinedSchemaImpl();
      fInlinedSchema2 = new InlinedSchemaImpl();
      fImportedSchema1 = new ImportedSchemaImpl();
      fImportedSchema2 = new ImportedSchemaImpl();
    }
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

      fInterfaceElement.setName(new NCName("interfaceName"));
      fServiceElement = fDescriptionElement.addServiceElement();
      fServiceElement.setName(new NCName("serviceName"));

        //Create a test schema
        InlinedSchema schema = new InlinedSchemaImpl();
        XmlSchema xs1 = null;
        URI schemaNS = null;

        String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\">"
                    + "<element  name=\"myEd\" type=\"string\"/>"
                    + "<complexType name=\"myTypeDef\">"    
                    + "<sequence>"    
                    + "<element name=\"element\" type=\"string\"/>"     
                    + "</sequence>"    
                    + "</complexType>"
                    + "</schema>";
       
        DOMParser builder = new DOMParser();
        Reader reader = new StringReader(schemaString);
        XMLInputSource is = new XMLInputSource(null, null, null, reader, null);
        try {
            builder.parse(is);
        } catch(IOException e) {
            fail("There was an IOException whilst trying to parse the sample schema.");
        }
        Document schemaDoc1 = builder.getDocument();
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        xs1 = xsc.read(schemaDoc1.getDocumentElement());
        schema.setSchemaDefinition(xs1);
     
        //Add it to the typesElement.
        TypesElement typesEl = fDescriptionElement.addTypesElement();
        typesEl.addSchema(schema);
       
View Full Code Here

Examples of org.apache.woden.internal.schema.InlinedSchemaImpl

        // Default case
        assertNull("When 'element' attribute is omitted, no ElementDeclaration should be present", msgRef.getElementDeclaration());
       
        // Test that the expected ElementDeclaration is returned
        TypesElement typesElement = fDescriptionElement.addTypesElement()//throws WSDLException
        InlinedSchema schema = new InlinedSchemaImpl();
        String schemaString = "<schema xmlns=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.sample.org\">"
                  + "<complexType name=\"myType\">"    
                  + "<sequence>"    
                  + "<element  name=\"element\" type=\"string\"/>"     
                  + "</sequence>"    
                  + "</complexType>"
                  + "<element name=\"myElement\" type=\"string\"/>"
                  + "</schema>";
        DOMParser builder = new DOMParser();
        Reader reader = new StringReader(schemaString);
        XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
        builder.parse(is)//throws IOException
        Document schemaDoc1 = builder.getDocument();
        XmlSchemaCollection xsc = new XmlSchemaCollection();
        XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
        schema.setSchemaDefinition(xs1);
        URI schemaNS = URI.create("http://www.sample.org");
        schema.setNamespace(schemaNS);
        typesElement.addSchema(schema);
       
        QName elemQN = new QName("http://www.sample.org","myElement");
       
        fMessageReferenceElement.setElement(new QNameTokenUnion(elemQN));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.