Hi,
I am trying to read in a simple sca-contribution.xml file using Tuscany.
Here is the contribution file:
<?xml version="1.0" encoding="UTF-8"?>
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://myexample.com/"
xmlns:test="http://mytest.com/">
<deployable composite="test:CalculatorComposite"/>
</contribution>
My test code looks like this:
AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
ContributionFactory contributionFactory = new ContributionFactoryImpl();
ContributionMetadataProcessor processor = new
ContributionMetadataProcessor(assemblyFactory, contributionFactory, null);
InputStream stream = new
FileInputStream("D:\\temp\\sca-contribution.xml");
XMLStreamReader reader =
XMLInputFactory.newInstance().createXMLStreamReader(stream);
Contribution contribution = processor.read(reader);
List<Composite> composites = contribution.getDeployables();
for (Composite composite : composites)
System.out.println(composite.getName());
The output which I get from running the code is:
{http://myexample.com/}CalculatorComposite
I'm puzzled by the fact the namespace for my composite is
http://myexample.com, which is the targetNamespace of my contribution
file. I expected the QName of my composite to be {
http://mytest.com/}CalculatorComposite since it's prefixed with "test". If
I remove the targetNamespace attribute completely, then my composite has
no namespace at all. What am I missing here? Is there something wrong
with my contribution file and/or my test code?
Thanks in advance. Any help is much appreciated.
Andrew