diff options
author | Glen Mazza <gmazza@apache.org> | 2005-03-02 01:59:40 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2005-03-02 01:59:40 +0000 |
commit | 24cb4e43f972beee5a79ee35a4e45763017ca7d9 (patch) | |
tree | fdd58d996cfa1c6ac5cf2fc97eef2408975a2a07 /src/java/org/apache/fop/fo/flow/TableFooter.java | |
parent | 8a70c2046b2a58670930b7fc74902052f8351ac2 (diff) | |
download | xmlgraphics-fop-24cb4e43f972beee5a79ee35a4e45763017ca7d9.tar.gz xmlgraphics-fop-24cb4e43f972beee5a79ee35a4e45763017ca7d9.zip |
Flag added in FOUserAgent for strict/unstrict validation (see TableBody to see how used.)
Validation added (only strict version) for TableFooter.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198463 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/flow/TableFooter.java')
-rw-r--r-- | src/java/org/apache/fop/fo/flow/TableFooter.java | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/fo/flow/TableFooter.java b/src/java/org/apache/fop/fo/flow/TableFooter.java index c64f0590a..5b42bd810 100644 --- a/src/java/org/apache/fop/fo/flow/TableFooter.java +++ b/src/java/org/apache/fop/fo/flow/TableFooter.java @@ -21,9 +21,12 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.FONode; +import org.xml.sax.Locator; +import org.apache.fop.apps.FOPException; +import org.apache.fop.fo.ValidationException; + /** * Class modelling the fo:table-footer object. - * @todo implement validateChildNode() */ public class TableFooter extends TableBody { @@ -34,6 +37,60 @@ public class TableFooter extends TableBody { super(parent); } + private boolean tableRowsFound = false; + private boolean tableColumnsFound = false; + + /** + * @see org.apache.fop.fo.FONode#startOfNode + */ + protected void startOfNode() throws FOPException { +// getFOEventHandler().startBody(this); + } + + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + * XSL Content Model: marker* (table-row+|table-cell+) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + if (nsURI == FO_URI) { + if (localName.equals("marker")) { + if (tableRowsFound || tableColumnsFound) { + nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)"); + } + } else if (localName.equals("table-row")) { + tableRowsFound = true; + if (tableColumnsFound) { + invalidChildError(loc, nsURI, localName, "Either fo:table-rows" + + " or fo:table-columns may be children of an fo:table-footer" + + " but not both"); + } + } else if (localName.equals("table-column")) { + tableColumnsFound = true; + if (tableRowsFound) { + invalidChildError(loc, nsURI, localName, "Either fo:table-rows" + + " or fo:table-columns may be children of an fo:table-footer" + + " but not both"); + } + } else { + invalidChildError(loc, nsURI, localName); + } + } else { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws FOPException { +// getFOEventHandler().endFooter(this); + if (!(tableRowsFound || tableColumnsFound)) { + missingChildElementError("marker* (table-row+|table-cell+)"); + } +// convertCellsToRows(); + } + /** * @see org.apache.fop.fo.FObj#getName() */ |