I'm looking at TUSCANY-3264 where namespaces are missing from some
elements when a composite is written out. I don't have specific proof
but it seems to be realted in some way to TUSCANY-3212. Debugging the
code into the BaseStAXArtifactProcessor I note that the problem arises
when writing out <t:binding.http/> in this code
protected void writeStart(XMLStreamWriter writer, String uri,
String name, XAttr... attrs) throws XMLStreamException {
String prefix = writeElementPrefix(writer, uri);
writer.writeStartElement(uri, name);
if (prefix != null){
writer.writeNamespace(prefix,uri);
}
writeAttributePrefixes(writer, attrs);
writeAttributes(writer, attrs);
}
writeElementPrefix returns non-null and hence writeNamespace() is not
called. This, I think, means that the stream thinks that it has
already written out this namespace. The written xml is as follows...
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://store"name="store-supplier">
<component name="StoreSupplier" uri="StoreSupplier">
<wstxns1:implementation.widget
xmlns:wstxns1="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:widget="http://tuscany.apache.org/xmlns/sca/1.0"
location="uiservices/store.html" />
<service name="Widget">
<interface.java
interface="org.apache.tuscany.sca.implementation.widget.Widget" />
<wstxns1:binding.http name="Widget" uri="http://localhost:8103/ui" />
<callback />
</service>
...
So it has already written out wstxns1 but not in a scope that contains
binding.http.
Now I'm a bit reluctant to dive in and start fixing this as there's a
good chance I'll mess us something else by doing so. I'd like to walk
though this with someone who knows how the writers are supposed to
work. Raymond?
Simon