diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2007-12-16 19:54:00 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2007-12-16 19:54:00 +0000 |
commit | 4f9fc957bdb3b4a1ecf9af8f6ed9aabf238a5022 (patch) | |
tree | 37de3df89cdb0b9ae69de64d284eee032cd9e4d9 /src/java/org/apache/fop/fo/flow | |
parent | 63bca7dc46c4baada7994f1b0541d4a090194a4a (diff) | |
download | xmlgraphics-fop-4f9fc957bdb3b4a1ecf9af8f6ed9aabf238a5022.tar.gz xmlgraphics-fop-4f9fc957bdb3b4a1ecf9af8f6ed9aabf238a5022.zip |
Streamlining/Correction of the changes made in r603926
- delegate validation of the fo:wrapper's children to the parent: added static FONode.validateChildNode()
- narrow the condition for processing text-childnodes:
this is not only constrained to fo:flow and fo:static-content, but the same goes
for a fo:wrapper that is a direct descendant of a fo:block-container or fo:inline-container,
which only allow block-level content (interpretation)
- minor javadoc fixups/improvements
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@604678 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/Wrapper.java | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/fo/flow/Wrapper.java b/src/java/org/apache/fop/fo/flow/Wrapper.java index 8b833f6b7..b116eddeb 100644 --- a/src/java/org/apache/fop/fo/flow/Wrapper.java +++ b/src/java/org/apache/fop/fo/flow/Wrapper.java @@ -38,49 +38,43 @@ public class Wrapper extends FObjMixed { // used for FO validation private boolean blockOrInlineItemFound = false; - private boolean isFlowChild = false; + private boolean inlineChildrenAllowed = false; /** * @param parent FONode that is the parent of this object */ public Wrapper(FONode parent) { super(parent); - /* Check if the fo:wrapper is a child of an fo:flow or fo:static-content + /* Check if the fo:wrapper is a child of a FO that allows mixed content * (or a descendant in nested fo:wrapper sequence, the first of which - * is a child of an fo:flow or fo:static-content */ + * is a child of a FO that allows mixed content) */ FONode ancestor = this.parent; - while (!(ancestor instanceof Flow) - && ancestor instanceof Wrapper) { + while (ancestor instanceof Wrapper) { ancestor = ancestor.getParent(); } - if (ancestor instanceof Flow) { - this.isFlowChild = true; + if (ancestor instanceof FObjMixed ) { + inlineChildrenAllowed = true; } } /** * {@inheritDoc} - * XSL Content Model: marker* (#PCDATA|%inline;|%block;)* - * Additionally (unimplemented): "An fo:wrapper that is a child of an + * <br>XSL Content Model: marker* (#PCDATA|%inline;|%block;)* + * <br><i>Additionally (unimplemented): "An fo:wrapper that is a child of an * fo:multi-properties is only permitted to have children that would - * be permitted in place of the fo:multi-properties." + * be permitted in place of the fo:multi-properties."</i> * */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { - if (FO_URI.equals(nsURI) && localName.equals("marker")) { + if (FO_URI.equals(nsURI) && "marker".equals(localName)) { if (blockOrInlineItemFound) { nodesOutOfOrderError(loc, "fo:marker", "(#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"); - } + //delegate validation to parent + FONode.validateChildNode(this.parent, loc, nsURI, localName); blockOrInlineItemFound = true; } else { invalidChildError(loc, nsURI, localName); @@ -94,9 +88,8 @@ public class Wrapper extends FObjMixed { int end, PropertyList pList, Locator locator) throws FOPException { - /* Only add text if the fo:wrapper is not a child of an fo:flow - * or fo:static-content */ - if (!this.isFlowChild) { + /* Only add text if the fo:wrapper's parent allows inline children */ + if (this.inlineChildrenAllowed) { super.addCharacters(data, start, end, pList, locator); } } |