You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Kay Michael <Mi...@icl.com> on 2000/10/06 15:13:58 UTC

Problems with FOP ContentHandler interface (at fop 0_14_0)

I've been upgrading Saxon to drive FOP 14; I see that the FOTreeBuilder
interface is now a SAX2 ContentHandler rather than a SAX1 DocumentHandler.
With the current releases of Saxon and FOP, the integration is broken.

I'm calling startPrefixMapping() to define the namespace declarations but
the code ignores these calls. It also seems to do nothing with the prefix
and uri passed on the startElement() call. Instead, it seems to expect
namespace declarations to be represented as xmlns:xx attributes.

The SAX2 specification for ContentHandler says: <quote>The attribute list
will contain attributes used for Namespace declarations (xmlns* attributes)
only if the http://xml.org/sax/features/namespace-prefixes property is true
(it is false by default, and support for a true value is optional).</quote>

Since I'm not a parser, FOP has no opportunity to set this property, so I
behave in the default way, and don't include namespace declarations in the
attribute list. The result is that FOP complains that "fo" is an undeclared
prefix.

Secondary problem: after startElement() bombs out with this error, my
clear-up path (foolishly) calls format(). This hits a NullPointerException
referencing rootFObj, masking all diagnostics for the real error. Since
format() is a public interface, it should probably be resilient to this
error.

Mike Kay



Re: Problems with FOP ContentHandler interface (at fop 0_14_0)

Posted by Karen Lease <kl...@club-internet.fr>.
Hello Mike,

Are you using the standard 0.14 jar or the latest CVS? I fixed something
that sounds similar to this a while ago (late August), but I think it
may not be in the jar, only in the CVS. With the fix, it should use the
namespace uri and local name and not expect to see fo:xxx.

Good luck,
Karen Lease

Kay Michael wrote:
> 
> I've been upgrading Saxon to drive FOP 14; I see that the FOTreeBuilder
> interface is now a SAX2 ContentHandler rather than a SAX1 DocumentHandler.
> With the current releases of Saxon and FOP, the integration is broken.
> 
> I'm calling startPrefixMapping() to define the namespace declarations but
> the code ignores these calls. It also seems to do nothing with the prefix
> and uri passed on the startElement() call. Instead, it seems to expect
> namespace declarations to be represented as xmlns:xx attributes.
> 
> The SAX2 specification for ContentHandler says: <quote>The attribute list
> will contain attributes used for Namespace declarations (xmlns* attributes)
> only if the http://xml.org/sax/features/namespace-prefixes property is true
> (it is false by default, and support for a true value is optional).</quote>
> 
> Since I'm not a parser, FOP has no opportunity to set this property, so I
> behave in the default way, and don't include namespace declarations in the
> attribute list. The result is that FOP complains that "fo" is an undeclared
> prefix.
> 
> Secondary problem: after startElement() bombs out with this error, my
> clear-up path (foolishly) calls format(). This hits a NullPointerException
> referencing rootFObj, masking all diagnostics for the real error. Since
> format() is a public interface, it should probably be resilient to this
> error.
> 
> Mike Kay