You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by Lance Robertson <la...@jda.com> on 2004/01/09 16:55:46 UTC
Removing the Namespace from each Tag
I'm new to XML beans and we are investigating it for use in our program.
However I've run across something that I need to remove from the output XML
before we can use it. When we generate XML using the XMLBeans the namespace
is added to each tag <ns1:tagname>. We need to not have the ns1: in the tag.
Is there a way to do this? I've looked through the mailing list and found
what I thought might have been a solution, however when I tried it it did
not work.
Is there a way for the namespace not to be added to each tag? Thank you in
advance
Solution Tried:
HashMap suggestedPrefixes = new HashMap();
suggestedPrefixes.put(" <http://company.com> http://company.com", "");
XmlOptions opts = new XmlOptions();
opts.setSaveSuggestedPrefixes(suggestedPrefixes); <---Tried this first
opts.setUseDefaultNamespace(); <--- Tried this second
try
{
newTimeslipsDoc.save(new File("TimeslipSample2.xml"), opts);
}
catch (Exception e)
{
System.out.println("Couldn't write file");
return;
}
Lance