Hi Stefan,
I was able to get this to work using the following declaration:
XmlOptions xo = new XmlOptions().setSavePrettyPrint();
ArrayList errors = new ArrayList();
xo.setErrorListener(errors);
xo = xo.setSaveAggressiveNamespaces();
xo = xo.setUseDefaultNamespace();
Then:
System.out.println("\nEMS w/ XO: " + emsDemographicDataSet.xmlText(xo));
System.out.println("\nEMS w/out XO: " + emsDemographicDataSet.xmlText());
Produces:
EMS w/ XO: <D09 Status="A" Date="2007-04-24-07:00" xmlns="http://www.nemsis.org"
<D09_04>Stuff</D09_04>
</D09>
EMS w/out XO: <nem:D09 Status="A" Date="2007-04-24-07:00" xmlns:nem="http://www.
nemsis.org"><nem:D09_04>Stuff</nem:D09_04></nem:D09>
And in your case to save out the file, this worked for me:
emsDemographicDataSet.save(new File("EMSOUT.xml"), xo);
to create a file like that produced by the output of EMS w/ XO
Please let me know if you are still having troubles,
-Jacob Danner
On 4/24/07, Stefan Offermann <[EMAIL PROTECTED]> wrote:
Jacob Danner schrieb:
> XmlOptions setUseDefaultNamespace()
> If this option is set, the saver will try to use the default
> namespace for the most commonly used URI.
>
> XmlOptions setSaveAggressiveNamespaces()
> Causes the saver to reduce the number of namespace prefix
> declarations.
I gave both a try, but none of them worked for me :(
Here is the code how I save the file:
---------------------
XmlOptions opts = new XmlOptions();
opts.setUseDefaultNamespace();
opts.setSaveAggressiveNamespaces();
RssDocument rssDocument = RssDocument.Factory.newInstance(opts);
/* adding the content ... */
rssDocument.save(new File(filename)); // exceptionhandling removed
---------------------
I also tried setSaveSuggestedPrefixes, but this method doesn't work, I
also would like to say that the whole XmlOptions-Object doesn't work in
my case, it changes nothing :(
Best regards, Stefan Offermann
--
Stefan Offermann
Institut für Geoinformatik
Westfälische Wilhelms-Universität
Robert-Koch-Str. 26-28
D-48149 Münster
Fon: +49 (0)251 83-31961
Mail: [EMAIL PROTECTED]
Web: http://www.ifgi.de
http://ifgi.uni-muenster.de/~offermann/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]