Ok, I found this as interesting. I was dumping the XML with the toString() method. If I dump the XML with the xmlText() (without passing any XMLOptions to it) method, all the namespace prefixes show up. Apparently that's not what is used when actually generating the SOAP message to send to the web service.
chris chrisneal wrote: > > Hi all. > > I have a schema file where the xmlbeans generated XML doc doesn't seem to > match it with regards to namespace prefixes. If I understand correctly, > when elementFormDefault or attributeFormDefault is set to "qualified", > then elements from the targetNameSpace must be qualified with the > namespace prefix. If they are set to "unqualified", then they do not need > to be. > > My xsd file looks like this: > > <schema > targetNamespace="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" > xmlns:tns="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" > > xmlns:ds="http://www.w3.org/2000/09/xmldsig#" > xmlns:xlink="http://www.w3.org/1999/xlink" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > xmlns="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified" > attributeFormDefault="qualified" > version="2.0c"> > > That's obviously just the <schema> element, not the entire doc :) The > rest of the document does not define any other form="unqualified" > attributes on any child elements, so again, if I understand correctly, the > "qualified" definitions from the <schema> element should be inherited by > its children. > > The XML doc that is generated looks like this: > > <MessageHeader > xmlns="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" > soapenv:mustUnderstand="0"> > <From> > <PartyId>data</PartyId> > </From> > <To> > <PartyId>data</PartyId> > </To> > <CPAId>data</CPAId> > <ConversationId>data</ConversationId> > <Service > xmlns:axis2ns2="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" > axis2ns2:type="4.0">data</Service> > <Action>data</Action> > <MessageData> > <MessageId>1</MessageId> > <Timestamp>2008-05-22T15:33:02.576-05:00</Timestamp> > </MessageData> > </MessageHeader> > > Which produces errors from the web service. When I manually change it to > look like this: > > <ns2:MessageHeader xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:ns2="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" > ns1:mustUnderstand="false" ns2:version="4.0"> > <ns2:From> > <ns2:PartyId>data</ns2:PartyId> > </ns2:From> > <ns2:To> > <ns2:PartyId>data</ns2:PartyId> > </ns2:To> > <ns2:CPAId>data</ns2:CPAId> > <ns2:ConversationId>data</ns2:ConversationId> > <ns2:Service ns2:type="4.0">data</ns2:Service> > <ns2:Action>data</ns2:Action> > <ns2:MessageData> > <ns2:MessageId>1</ns2:MessageId> > <ns2:Timestamp>2008-05-22T15:33:02.576-05:00</ns2:Timestamp> > </ns2:MessageData> > </ns2:MessageHeader> > > Then everything works great. > > Shouldn't my XMLBeans output look like the element that works, and not the > one it is actually producing, based on the schema definition? Or am I > missing something? > > Thanks so much! > chris > > > -- View this message in context: http://www.nabble.com/Question-about-element-attributeFormDefault-and-xmlbeans-output-tp17514490p17515908.html Sent from the Xml Beans - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

