Sounds reasonable to me--I think I should have done the validation that way to begin with (IIRC =='s are Not Good with Strings anyway for the very reason you gave.) I am surprised this problem did not occur before. I'll make the change next.

I am personally pleased that FOP 1.0 is now activatible by directly instantiating FOTreeBuilder, i.e. one can avoid the apps package completely. This is because FOTreeBuilder now has all its needed business logic within it. Still, you may wish to try this method[1] for your work (i.e., using the apps.Fop class instead of FOTreeBuilder directly). FOP.getDefaultHandler()[2] should do the same thing as your "new SAXResult(FOTreeBuilder)", but FOTreeBuilder is within FOP's "black box" and may not be available/could be renamed, etc., in the future.

Also, I have to update our "embed" page -- apparently the links to our examples are no longer working.

[Team--"viewSVN" apparently does not have an "annotate" (can see line numbers) option -- Grrrr!!!!]

Thanks,
Glen

[1] *http://tinyurl.com/8ofpc*
[2] *http://tinyurl.com/c7c3z*


Nils Meier wrote:

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