I made a copy of the document before calling writeNode and all is well :-) ?????
I added code to the buildTypesWithSchemaImports method in ServiceWSDLBuilder and this certainly resolves the issue. I have added a FIXME as I am still not sure why it fixes the issue. Works well now, but I am not sure of the consequences of this action. Anyway I will add this to the patch in jira as it does solve the problem. Perhaps a developer can suggest a better idea. On Thu, Mar 29, 2012 at 6:50 PM, Jason Pell <ja...@pellcorp.com> wrote: > Something strange is happening when outputting an XSD with a namespace > embedded in > an element. > > For example: > > <xsd:element xmlns:xmime="http://www.w3.org/2005/05/xmlmime" > name="content" > xmime:expectedContentTypes="application/octet-stream" > type="xsd:base64Binary" /> > > When its output by using StaxUtils.writeNode(doc, writer, true); > > the xmlns:xmime="http://www.w3.org/2005/05/xmlmime" is omitted. I can > confirm this in test cases. > > What is interesting is that if I use StaxUtils.copy(doc, writer), the > namespace remains. > > I can only reproduce this from the ServiceWSDLBuilder, if I save a XSD > and read in directly I cannot see the problem. So there must be > something different about the Document I produce from the > ServiceWSDLBuilder and that read from file system, I can't for the > life of me work it out. When I print the contents of the one built > from ServiceWSDLBuilder using XMLUtils.generateXMLFile it looks > exactly the same. > > Any ideas at all, or perhaps I need to provide more info. > > On Thu, Mar 29, 2012 at 1:14 PM, Jason Pell <ja...@pellcorp.com> wrote: >> I have submitted a complete patch for review >> (https://issues.apache.org/jira/browse/CXF-4196). >> >> Please take a look at it and let me know if I need to add anything / >> change anything. >> >> I am hoping that can be included in 2.5.3 >> >> Thanks >> Jason