You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Dan Durkin <dd...@scilearn.com> on 2005/09/28 22:17:48 UTC

Saving to xml with no namespace

Using XmlOptions.setLoadSubstituteNamespaces() I was able to parse a 
document with no namespaces.

Is there a way to do the reverse of this and take an XmlObject instance 
and save an xml file with no namespace?

the following code:

HashMap noPrefixMap = new HashMap();
noPrefixMap.put("http://foo.com/bar", "");
XmlOptions outputOpts = new XmlOptions();
outputOpts.setSavePrettyPrint();
outputOpts.setSaveSuggestedPrefixes(noPrefixMap);
anXmlObject.save( new java.io.File("test/testout.xml" ), outputOpts);

results in no prefixes but does declare a default namespace.

<foo xmlns="http://foo.com/bar">
   <bar/>
</foo>


Thanks,

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org