Hi, Has anyone else run into this problem I'm seeing with reading in contribution xml files? (please see my original post below) Is there anything wrong with my test program?
Thanks in advance. Andrew Andrew Mak/Toronto/[EMAIL PROTECTED] 09/13/2007 08:34 PM Please respond to [email protected] To [email protected] cc Subject Re: reading in sca-contribution.xml file Hi Raymond, I am using 0.99 level of Tuscany. I noticed that in all the samples included in Tuscany, the targetNamespace attribute is there. For example, samples\calculator-webapp-ws\src\main\webapp\META-INF\sca-contribution.xml has it: <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://sample" xmlns:sample="http://sample"> <deployable composite="sample:Calculator"/> </contribution> But in this case targetNamespace == xmlns:sample so the QName printed is "{http://sample}Calculator". However if I remove the targetNamespace attribute then the QName printed is simply "Calculator". Thanks, Andrew "Raymond Feng" <[EMAIL PROTECTED]> 09/13/2007 06:08 PM Please respond to [email protected] To <[email protected]> cc Subject Re: reading in sca-contribution.xml file Hi, Thank you for reporting the issue. 1) The targetNamespace attribute shoudn't be in the sca-definitions.xml 2) Even with that, I tried a similar case and the result is good, i.e. {http://mytest.com}CalculatorComposite is returned. Which level of Tuscany code are you using? Thanks, Raymond ----- Original Message ----- From: "Andrew Mak" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, September 13, 2007 12:19 PM Subject: reading in sca-contribution.xml file > 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
