}
/**
- *
+ * Primarily used for making final content model validation checks
+ * and/or informing the FOEventHandler that the end of this FO
+ * has been reached.
*/
protected void endOfNode() throws FOPException {
// do nothing by default
package org.apache.fop.fo.flow;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
/**
* Class modelling the fo:block-container object.
- * @todo implement validateChildNode()
*/
public class BlockContainer extends FObj {
// The value of properties relevant for fo:block-container.
private Numeric zIndex;
// End of property values
+ /** used for FO validation */
+ private boolean blockItemFound = false;
+
/**
* @param parent FONode that is the parent of this object
*/
getFOEventHandler().startBlockContainer(this);
}
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: marker* (%block;)+
+ * But: "In addition an fo:block-container that does not generate an
+ * absolutely positioned area may have a sequence of zero or more
+ * fo:markers as its initial children."
+ * @todo - implement above restriction if possible
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws ValidationException {
+ 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;
+ }
+ }
+
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
+ if (!blockItemFound) {
+ missingChildElementError("marker* (%block;)+");
+ }
+
getFOEventHandler().endBlockContainer(this);
}
import java.util.ArrayList;
import java.util.List;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
/**
* Class modelling the fo:inline-container object.
- * @todo implement validateChildNode()
*/
public class InlineContainer extends FObj {
// The value of properties relevant for fo:inline-container.
private int writingMode;
// End of property values
+ /** used for FO validation */
+ private boolean blockItemFound = false;
+
/**
* @param parent FONode that is the parent of this object
*/
checkId(id);
}
+ /**
+ * @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 ValidationException {
+ 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;
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#endOfNode
+ */
+ protected void endOfNode() throws FOPException {
+ if (!blockItemFound) {
+ missingChildElementError("marker* (%block;)+");
+ }
+ }
+
/**
* Return the "id" property.
*/
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.KeepProperty;
/**
* Class modelling the fo:list-item-body object.
- * @todo implement validateChildNode()
*/
public class ListItemBody extends FObj {
// The value of properties relevant for fo:list-item-body.
}
/**
- * Make sure content model satisfied, if so then tell the
- * FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
package org.apache.fop.fo.flow;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.KeepProperty;
private KeepProperty keepTogether;
// End of property values
+ /** used for FO validation */
+ private boolean blockItemFound = false;
+
/**
* @param parent FONode that is the parent of this object
*/
getFOEventHandler().startListLabel();
}
+ /**
+ * @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 ValidationException {
+ 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;
+ }
+ }
+
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
+ if (!blockItemFound) {
+ missingChildElementError("marker* (%block;)+");
+ }
+
getFOEventHandler().endListLabel();
}
package org.apache.fop.fo.flow;
// FOP
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
+
/**
* Class modelling the fo:multi-toggle property.
- * @todo implement validateChildNode()
*/
public class MultiToggle extends FObj {
// The value of properties relevant for fo:multi-toggle.
commonAccessibility = pList.getAccessibilityProps();
// prSwitchTo = pList.get(PR_SWITCH_TO);
- if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-toggle is not yet implemented.");
- notImplementedWarningGiven = true;
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ * XSL Content Model: (#PCDATA|%inline;|%block;)*
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws ValidationException {
+ if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
}
}