Hi Andreas,

> Author: adelmelle
> Date: Thu Dec 13 06:43:08 2007
> New Revision: 603926
> 
> URL: http://svn.apache.org/viewvc?rev=603926&view=rev
> Log:
> Minor tweaks:
> * only add text to a fo:wrapper if it is not a direct flow-descendant
> * error if an fo:wrapper that is a direct flow-descendant contains 
> inline-level children
> 
> Modified:
>     xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/flow/Wrapper.java
> 
> +        /* Check if the fo:wrapper is a child of an fo:flow or 
> fo:static-content
> +         * (or a descendant in nested fo:wrapper sequence, the first of which
> +         *  is a child of an fo:flow or fo:static-content */
> +        FONode ancestor = this.parent;
> +        while (!(ancestor instanceof Flow)
> +                && ancestor instanceof Wrapper) {

Might be wrong, but isn’t that the very same as:
    while (!(ancestor instanceof Wrapper))
?

<snip/>

>      protected void validateChildNode(Locator loc, String nsURI, 
>      String localName) throws ValidationException {
> @@ -58,9 +74,30 @@
>                      "(#PCDATA|%inline;|%block;)");
>              }
>          } else if (isBlockOrInlineItem(nsURI, localName)) {
> +            if (isFlowChild
> +                    && isInlineItem(nsURI, localName)
> +                    && !isNeutralItem(nsURI, localName)) {
> +                invalidChildError(loc, nsURI, localName,
> +                        "fo:" + localName + " not allowed as child of an 
> fo:wrapper "
> +                        + "that is a child of an fo:flow or 
> fo:static-content");
> +            }
>              blockOrInlineItemFound = true;
>          } else {
>              invalidChildError(loc, nsURI, localName);

And regarding the validation, wouldn’t it be safer to call the 
validateChildNode of the nearest non-wrapper ancestor? That way this 
class would really keep neutral, and we wouldn’t have to worry about the 
implementation of new FO elements.


My 2 cents,
Vincent

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

Reply via email to