Re: [xep-support] Intermittent problem with Renderer

From: Nikolai Grigoriev (grig@renderx.com)
Date: Mon Oct 21 2002 - 13:22:52 PDT


Hi Bob,

> Periodically when our application fails the following
> message is always displayed.
>
> (S (parse [system-id
> file:c:/SERVICES/applications/xep2.7/untitled.fo]
> {!line 2, column 104: Document root element
> "fo:root", must match DOCTYPE root "null".}

It's a validation message from Xerces. You know that
XEP 2.7x preprocesses its character stream to insert
a DTD reference for the validating parser. The
procedure is somewhat fragile: looks like it chokes
in your case.

> You product is mounted as a SOAP service. A string is
> passed to it as an argument. The service is
> configured to interpret the string as either a file
> URL or XML. An input source is provided accordingly.
> This error has so far only been observed when the
> XML is passed as string directly. The FOInputSource
> is constructed and its CharacterStream is set to a
> StringReader - see code below.

O-o-ps - you should not call CharacterStream from FOInputSource.
As explained in the documentation, this method is redefined
to handle DTD insertion, and is not designed for direct usage.
If you insist on DTD validation, you have transform your string
into a byte array in UTF-8, and then feed it as a ByteArrayInputStream
to setByteStream() method of FOInputSource.

However, I believe that DTD-based validation is unsafe in this context.
I suggest to turn validation off, and pass input data from a normal
org.xml.sax.InputSource, rather than FOInputSource. See
doc/samples/SAXInput/ for a code sample.

Best regards,
Nikolai Grigoriev
RenderX

-------------------
By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html



This archive was generated by hypermail 2.1.5 : Wed Dec 18 2002 - 08:41:28 PST