Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XMLBeans xmlText without Namespace-Prefix

843834Jan 3 2005 — edited Feb 10 2005
Hi!

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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2005
Added on Jan 3 2005
1 comment
160 views