No there's nothing wrong with your code, it's another Saxon bug.
It's looking quite a pig's ear. I think I made a change here to make the
JAXP interface work according to spec (which is itself pretty treacherous)
and this caused an upset here. The basic problem is working out how the
serialization parameters supplied via the API relate to those specified
inside the transformation or query, and for s9api that has never been very
clearly defined. I think the rule should probably be that a parameter
supplied via the API overrides one supplied in the query or transformation
source. Unfortunately the code isn't structured to make that easy to
achieve, so I'm having a bit of trouble devising a patch - especially
without destabilizing the rather delicate JAXP code in this area.
I'm working on it.
> -----Original Message-----
> From: saxon-help-bounces@...
> [mailto:saxon-help-bounces@...] On Behalf
> Of Norman Walsh
> Sent: 22 July 2008 16:05
> To: saxon-help@...
> Subject: [saxon] omit-xml-declaration?
> Hi Michael,
> Is there something obvious wrong with this code, with respect
> to omit-xml-declaration, I mean?
> XQueryCompiler xqcomp = qtproc.newXQueryCompiler();
> XQueryExecutable xqexec = xqcomp.compile(".");
> XQueryEvaluator xqeval = xqexec.load();
> Serializer serializer = new Serializer();
> RK, "no");
> serializer.setOutputProperty(Serializer.Property.INDENT, "no");
> serializer.setOutputProperty(Serializer.Property.METHOD, "xml");
> ARATION, "yes");
> ByteArrayOutputStream os = new ByteArrayOutputStream();
> String result = os.toString();
> The resulting string seems to *always* have an XML declaration.
> Be seeing you,
> Norman Walsh <ndw@...> | It does not do harm to the mystery to
> http://nwalsh.com/ | know a little about it. For far more
> | marvelous is the truth than
> any artists
> | of the past imagined!--Richard Feynman