shane nuessler wrote:
Hi,

We need some advice on how to stop Xindice storing DTD comments with the XML document. Are there any obvious fixes we just havn't found?

There's two ways to stop this from happening, one smart way and one stupid way. Both work.

The smart way is a to make a JAXP call:

   javax.xml.parsers.DocumentBuilderFactory.setIgnoringCommments(false);

prior to creating your DocumentBuilder. If this doesn't work, your XML
parser apparently isn't supporting this feature correctly. Are you
using Xerces? (This works for me, and I am using Xerces)

The stupid way is to simply take whatever DTDs you're using and remove
all of their comments. I generally not only remove comments but also
normalize them, expanding parameter entities and removing excess white
space to decrease size and improve performance. To normalize a DTD, you
can use James Clark's 'spam' tool (part of SP toolkit from jclark.com),
and then some hand-editing in vi. I then checked to be sure the edited
version matches the original using Earl Hood's dtddiff (part of his
perlSGML package). I knocked XHTML 1.1 from 152K down to 28K, if that's
any indication of "being worth the trouble".

Murray

SP:       http://jclark.com/sp/index.htm
perlSGML: http://www.oac.uci.edu/indiv/ehood/
...........................................................................
Murray Altheim                         http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK                    .

   "Shhh. Be vewy, vewy quiet. We're hunting wabbits." -- Elmer Fudd

   "I don't know how close we are, closer than we were yesterday,
    I guess. All I know is we're on the hunt." -- George W. Bush
    BBC News: http://news.bbc.co.uk/1/hi/world/americas/3110615.stm



Reply via email to