From 07493978a3bd4e9903484f79c6db33a9bcc77f54 Mon Sep 17 00:00:00 2001 From: Simon Pepping Date: Wed, 2 Mar 2005 21:03:25 +0000 Subject: [PATCH] Corrected a validation problem. Made TableFooter use TableBody's validation. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198465 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/fo/flow/TableBody.java | 18 ++++----- .../org/apache/fop/fo/flow/TableFooter.java | 40 +------------------ 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/src/java/org/apache/fop/fo/flow/TableBody.java b/src/java/org/apache/fop/fo/flow/TableBody.java index 5b054e300..bf9aac835 100644 --- a/src/java/org/apache/fop/fo/flow/TableBody.java +++ b/src/java/org/apache/fop/fo/flow/TableBody.java @@ -53,8 +53,8 @@ public class TableBody extends FObj { private PropertyList savedPropertyList; - private boolean tableRowsFound = false; - private boolean tableColumnsFound = false; + protected boolean tableRowsFound = false; + protected boolean tableCellsFound = false; /** * @param parent FONode that is the parent of the object @@ -93,7 +93,7 @@ public class TableBody extends FObj { */ protected void endOfNode() throws FOPException { getFOEventHandler().endBody(this); - if (!(tableRowsFound || tableColumnsFound)) { + if (!(tableRowsFound || tableCellsFound)) { if (getUserAgent().validateStrictly()) { missingChildElementError("marker* (table-row+|table-cell+)"); } else { @@ -113,21 +113,21 @@ public class TableBody extends FObj { throws ValidationException { if (nsURI == FO_URI) { if (localName.equals("marker")) { - if (tableRowsFound || tableColumnsFound) { + if (tableRowsFound || tableCellsFound) { nodesOutOfOrderError(loc, "fo:marker", "(table-row+|table-cell+)"); } } else if (localName.equals("table-row")) { tableRowsFound = true; - if (tableColumnsFound) { + if (tableCellsFound) { invalidChildError(loc, nsURI, localName, "Either fo:table-rows" + - " or fo:table-columns may be children of an fo:table-body" + + " or fo:table-cells may be children of an " + getName() + " but not both"); } - } else if (localName.equals("table-column")) { - tableColumnsFound = true; + } else if (localName.equals("table-cell")) { + tableCellsFound = true; if (tableRowsFound) { invalidChildError(loc, nsURI, localName, "Either fo:table-rows" + - " or fo:table-columns may be children of an fo:table-body" + + " or fo:table-cells may be children of an " + getName() + " but not both"); } } else { diff --git a/src/java/org/apache/fop/fo/flow/TableFooter.java b/src/java/org/apache/fop/fo/flow/TableFooter.java index 5b42bd810..6db9242e8 100644 --- a/src/java/org/apache/fop/fo/flow/TableFooter.java +++ b/src/java/org/apache/fop/fo/flow/TableFooter.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,9 +37,6 @@ public class TableFooter extends TableBody { super(parent); } - private boolean tableRowsFound = false; - private boolean tableColumnsFound = false; - /** * @see org.apache.fop.fo.FONode#startOfNode */ @@ -47,45 +44,12 @@ public class TableFooter extends TableBody { // 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)) { + if (!(tableRowsFound || tableCellsFound)) { missingChildElementError("marker* (table-row+|table-cell+)"); } // convertCellsToRows(); -- 2.39.5