XmlOptions xmlOptions = new XmlOptions(); //key = uri, value = prefix Map<String, String> namespaceMap = new HashMap<String, String>(); namespaceMap.put("http://foo.com/bar", "foo"); xmlOptons.setSaveSuggestedPrefixes(namespaceMap);
xmlObject.save(System.out, xmlOptions); The above should force the namespace of http://foo.com/bar to be prefixed with foo: Birch On Fri, May 23, 2008 at 11:26 AM, Jacob Danner <[EMAIL PROTECTED]> wrote: > Hi, > Have you tried validating the content? I'm curious what the output is. > I would be extremely surprised if the/a namespace prefix were > required. When I've seen this error when dealing with web services, it > usually indicates an element is out of order. > -jacobd > > On Fri, May 23, 2008 at 7:32 AM, chrisneal <[EMAIL PROTECTED]> wrote: >> >> Hello all, >> >> I've got a XML document build that looks like this: >> >> <MessageHeader >> xmlns="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" >> soapenv:mustUnderstand="0"> >> <From> >> <PartyId>myparth</PartyId> >> </From> >> <To> >> <PartyId>theirparty</PartyId> >> </To> >> <CPAId>somethinghere</CPAId> >> <ConversationId>blah</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 is completely valid. But for some reason, if I don't make it 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>30094</ns2:MessageId> >> <ns2:Timestamp>2007-08-14T15:41:21.466-05:00</ns2:Timestamp> >> </ns2:MessageData> >> </ns2:MessageHeader> >> >> Then the service errors out with a bunch of "Unexpected element" messages. >> :S >> >> Is there a way in xmlbeans to have it redundantly display the namespace >> prefix? >> >> Thanks! >> >> -- >> View this message in context: >> http://www.nabble.com/Is-there-a-way-to-force-namespace-prefixes-to-appear--tp17426936p17426936.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] >> >> > > > > -- > I'm competing in a Half-Ironman distance triathlon to raise money for > the fight against cancer! > Please help support my efforts by going to: > http://www.active.com/donate/tntwaak/jacobd > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]