protected void addChildNode(FONode child) throws FOPException {
}
+ /**
+ * Removes a child node. Used by the child nodes to remove themselves, for
+ * example table-body if it has no children.
+ * @param child child node to be removed
+ */
+ public void removeChild(FONode child) {
+ //nop
+ }
+
/**
* @return the parent node of this node
*/
public int getNameId() {
return Constants.FO_UNKNOWN_NODE;
}
+
}
}
}
+ /** @see org.apache.fop.fo.FONode#removeChild(org.apache.fop.fo.FONode) */
+ public void removeChild(FONode child) {
+ if (childNodes != null) {
+ childNodes.remove(child);
+ }
+ }
+
/**
* Find the nearest parent, grandparent, etc. FONode that is also an FObj
* @return FObj the nearest ancestor FONode that is an FObj
*/
protected void endOfNode() throws FOPException {
getFOEventHandler().endBody(this);
+ if (childNodes == null || childNodes.size() == 0) {
+ getLogger().error("fo:table-body must not be empty. "
+ + "Expected: (table-row+|table-cell+)");
+ getParent().removeChild(this);
+ }
convertCellsToRows();
}
*/
private void convertCellsToRows() throws FOPException {
try {
- if (childNodes.size() == 0 || childNodes.get(0) instanceof TableRow) {
+ if (childNodes == null
+ || childNodes.size() == 0
+ || childNodes.get(0) instanceof TableRow) {
return;
}
//getLogger().debug("Converting cells to rows...");