You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Vincent-Olivier Arsenault <vi...@up4c.com> on 2003/03/06 01:35:17 UTC
XHTML Output Format
Hi all!
I have always been using the "org.apache.xml.serialize" package to
output my SAX stream.
Until today, I was using the Method.HTML output format. I tried to
switch to Method.HTML, but since the script tags are not serialized as
CDATA (I have lots of inline dynamic scripts), it makes it unusable.
I tried everything :
String[] elements = {"script", "style"};
OutputFormat lOutputFormat = new OutputFormat(Method.XHTML, null, false);
lOutputFormat.setDoctype("-//W3C//DTD XHTML 1.0 Transitional//EN",
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd");
lOutputFormat.setOmitXMLDeclaration(false);
lOutputFormat.setOmitDocumentType(false);
lOutputFormat.setPreserveSpace(true);
lOutputFormat.setNonEscapingElements(elements);
lOutputFormat.setCDataElements(elements);
SerializerFactory lSerializerFactory =
SerializerFactory.getSerializerFactory(lOutputFormat.getMethod());
Serializer lSerializer = lSerializerFactory.makeSerializer(lOutputFormat);
lSerializer.setOutputByteStream(iOutputStream);
Anybody has an idea?
thanks,
v-o
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org