XML Declaration not serialized

  • Thread starter Guillaume Jeudy
  • Start date
G

Guillaume Jeudy

Hi,

I'm trying to serialize a DOM using the xalan package. I have a
problem with the XML declaration not getting printed. Here's a snippet
of code showing the initialization of the
org.apache.xalan.serialize.SerializerToXML:

Properties outputFormat =
OutputProperties.getDefaultMethodProperties(Method.XML);
outputFormat.put(OutputProperties.S_KEY_INDENT_AMOUNT, "3");
outputFormat.put(OutputKeys.INDENT, "yes");
outputFormat.put(OutputKeys.OMIT_XML_DECLARATION, "no");
serializer = new SerializerToXML();
serializer.setOutputFormat(outputFormat);

The indent & indent amount properties do work as I see proper
indentation in the serialization output. However the XML declaration
does not appear in the serialized output.

Can someone please help? I can't figure where to output that damn XML
header.
 
T

True Gamer

It is not necessary to use the XML declaration in version 1. You
probably should not use it if it is giving you that kind of problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top