aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-08-29 13:27:08 +0000
committerGlen Mazza <gmazza@apache.org>2004-08-29 13:27:08 +0000
commit450f1eeb3a2bd8caf2238e642097d16906c04e37 (patch)
tree39d708c46b1b361affee3381261a4603eb01bf05 /src/java/org/apache/fop/fo
parenta82edcd7590fecc47ed5ba35d41f3666228e238e (diff)
downloadxmlgraphics-fop-450f1eeb3a2bd8caf2238e642097d16906c04e37.tar.gz
xmlgraphics-fop-450f1eeb3a2bd8caf2238e642097d16906c04e37.zip
Three more validateChildNodes() added.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r--src/java/org/apache/fop/fo/flow/MultiSwitch.java29
-rw-r--r--src/java/org/apache/fop/fo/flow/TableAndCaption.java54
-rw-r--r--src/java/org/apache/fop/fo/flow/TableCaption.java38
3 files changed, 118 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/fo/flow/MultiSwitch.java b/src/java/org/apache/fop/fo/flow/MultiSwitch.java
index 9c653172c..bc075ab7f 100644
--- a/src/java/org/apache/fop/fo/flow/MultiSwitch.java
+++ b/src/java/org/apache/fop/fo/flow/MultiSwitch.java
@@ -18,13 +18,18 @@
package org.apache.fop.fo.flow;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
/**
* Class modelling the fo:multi-switch object.
- * @todo implement validateChildNode()
+ * @todo needs implementation
*/
public class MultiSwitch extends FObj {
@@ -43,6 +48,28 @@ public class MultiSwitch extends FObj {
}
/**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: (multi-case+)
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (!(nsURI == FO_URI && localName.equals("multi-case"))) {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * Make sure content model satisfied, if so then tell the
+ * FOInputHandler that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#end
+ */
+ protected void endOfNode() throws SAXParseException {
+ if (childNodes == null) {
+ missingChildElementError("(multi-case+)");
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.FObj#getName()
*/
public String getName() {
diff --git a/src/java/org/apache/fop/fo/flow/TableAndCaption.java b/src/java/org/apache/fop/fo/flow/TableAndCaption.java
index 8538cc4f1..0229b0cb3 100644
--- a/src/java/org/apache/fop/fo/flow/TableAndCaption.java
+++ b/src/java/org/apache/fop/fo/flow/TableAndCaption.java
@@ -18,18 +18,27 @@
package org.apache.fop.fo.flow;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
/**
* Class modelling the fo:table-and-caption property.
- * @todo implement validateChildNode()
+ * @todo needs implementation
*/
public class TableAndCaption extends FObj {
static boolean notImplementedWarningGiven = false;
+ /** used for FO validation */
+ private boolean tableCaptionFound = false;
+ private boolean tableFound = false;
+
/**
* @param parent FONode that is the parent of this object
*/
@@ -43,6 +52,49 @@ public class TableAndCaption extends FObj {
}
/**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: marker* table-caption? table
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+
+ if (nsURI == FO_URI && localName.equals("marker")) {
+ if (tableCaptionFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "fo:table-caption");
+ } else if (tableFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "fo:table");
+ }
+ } else if (nsURI == FO_URI && localName.equals("table-caption")) {
+ if (tableCaptionFound) {
+ tooManyNodesError(loc, "fo:table-caption");
+ } else if (tableFound) {
+ nodesOutOfOrderError(loc, "fo:table-caption", "fo:table");
+ } else {
+ tableCaptionFound = true;
+ }
+ } else if (nsURI == FO_URI && localName.equals("table")) {
+ if (tableFound) {
+ tooManyNodesError(loc, "fo:table");
+ } else {
+ tableFound = true;
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * Make sure content model satisfied, if so then tell the
+ * FOInputHandler that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#end
+ */
+ protected void endOfNode() throws SAXParseException {
+ if (!tableFound) {
+ missingChildElementError("marker* table-caption? table");
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.FObj#getName()
*/
public String getName() {
diff --git a/src/java/org/apache/fop/fo/flow/TableCaption.java b/src/java/org/apache/fop/fo/flow/TableCaption.java
index cbe53a4d0..b76577156 100644
--- a/src/java/org/apache/fop/fo/flow/TableCaption.java
+++ b/src/java/org/apache/fop/fo/flow/TableCaption.java
@@ -18,16 +18,24 @@
package org.apache.fop.fo.flow;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
/**
* Class modelling the fo:table-caption object.
- * @todo implement validateChildNode()
+ * @todo needs implementation
*/
public class TableCaption extends FObj {
+ /** used for FO validation */
+ private boolean blockItemFound = false;
+
static boolean notImplementedWarningGiven = false;
/**
@@ -43,6 +51,34 @@ public class TableCaption extends FObj {
}
/**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: marker* (%block;)
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (nsURI == FO_URI && localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
+ }
+ }
+
+ /**
+ * Make sure content model satisfied, if so then tell the
+ * FOInputHandler that we are at the end of the flow.
+ * @see org.apache.fop.fo.FONode#end
+ */
+ protected void endOfNode() throws SAXParseException {
+ if (childNodes == null) {
+ missingChildElementError("marker* (%block;)");
+ }
+ }
+
+ /**
* @see org.apache.fop.fo.FObj#getName()
*/
public String getName() {