You can use XmlOptions.setSaveSuggestedPrefixes() to specify the namespace prefixes.
See the FAQ for details: http://wiki.apache.org/xmlbeans/XmlBeansFaq#suggestedPrefixes ==================== Actually ,I have seen the faq and I found it did not work ,my codes: Map<String,String> nMap=new HashMap<String,String>(); nMap.put("http://www.swe.com/ow","com"); nMap.put("http://www.swe.net","net"); doc.xmlText(new XmlOption().setSaveSuggestionPrefixes(nMap)); the namespace is still the ns1 ns2.... ======================================================== 在2009-05-25?20:59:25,"Christian?Kaltepoth"?<[email protected]>?写道: >On?Monday?25?May?2009?11:13:55?apachexmlbeans?wrote: >>?With?the?xmlbeans?I?made?a?xml?file,however?the?namespace?is?"n1?n2"?and?so >>?how?to?specify?them??they?should?look?like?this: > >You?can?use?XmlOptions.setSaveSuggestedPrefixes()?to?specify?the? >namespace?prefixes. > >See?the?FAQ?for?details: >http://wiki.apache.org/xmlbeans/XmlBeansFaq#suggestedPrefixes > > >>?what?is?the?difference?between?the?add?and?set?method? >>?take?the?above?for?example: >>?Execute.addNewInstance(IdentifierType?id) >>?Execute.setIdentifier(CodeType?id) > >IMHO?the?addNewXXX()?methods?a?short?form?for?creating?a?new?XmlObject?and? >setting?it?via?the?setXXX()?method. > >See: >http://xmlbeans.apache.org/docs/2.4.0/guide/conMethodsForGeneratedJavaTypes.html > >Kind?regards > >Christian > >--? >Christian?Kaltepoth >Blog:?http://chkal.blogspot.com/ >Twitter:?http://twitter.com/chkal > >--------------------------------------------------------------------- >To?unsubscribe,?e-mail:[email protected] >For?additional?commands,?e-mail:[email protected] >

