Hi

I've tried to use FOP for this scenario :

 + I have a docbook DOM tree
 + I send it through a transformer using docbook-xsl to generate fo
 + The output of that transformation 'is piped' into the result 
    new SAXResult(new FOTreeBuilder)

so no files are generated - the FOTreeBuilder is fed directly
from an in-memory DOM tree.

Now the subtypes inheriting from FONode contain an identity
check in:

    protected void validateChildNode(Locator loc, String nsURI, String
localName) throws ValidationException {
        if (nsURI == FO_URI ...

This fails because FO_URI != nsURI *but* FO_URI.equals(nsURI). This
is so because the generated FO document was dynamically created in 
my setup - apparently without String.intern() for the namespace URI.

I'd propose to replace all those identity checks with .equals() to make
this safe without relying on intern()-Strings - example:

public class Root extends FObj {

 ...
  protected void validateChildNode(Locator loc, String nsURI, String
localName) throws ValidationException {
    if (FO_URI.equals(nsURI)) {
      ...

Does that sound reasonable? Affects around 30 types in
org.apache.fop.fo.*

Thanks
Nils




Reply via email to