XMLBeans xmlText without Namespace-Prefix
843834Jan 3 2005 — edited Feb 10 2005Hi!
i use XMLBeans and want to save a document to a xml-string representation
without using Namespace-Prefixes.
Generated XML should look like this
<Lohnsteuerbescheinigung art="LSTK" version="200502" xmlns="http://www.elsterlohn.de/2005-02/XMLSchema">
<Dauer jahr="2005">
...
</Lohnsteuerbescheinigung>
Currently, i get the following XML, with the code below:
<elo:Lohnsteuerbescheinigung xmlns:elo="http://www.elsterlohn.de/2005-02/XMLSchema" art="LSTK" version="200502">
<elo:Dauer jahr="2005">
...
</elo:Lohnsteuerbescheinigung>
public String getXmlText() {
Map mapNS = new HashMap();
mapNS.put("http://www.elsterlohn.de/2005-02/XMLSchema", "elo");
XmlOptions opts = new XmlOptions();
opts.setUseDefaultNamespace();
opts.setCharacterEncoding("iso-8859-1");
opts.setSavePrettyPrint();
opts.setSaveNamespacesFirst();
opts.setSaveSuggestedPrefixes(mapNS);
String xml = elsterDoc.xmlText(opts);
return xml;
}
Any ideas?