]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
More validation added for fo:retrieve-marker and fo:marker.
authorGlen Mazza <gmazza@apache.org>
Wed, 13 Apr 2005 02:56:33 +0000 (02:56 +0000)
committerGlen Mazza <gmazza@apache.org>
Wed, 13 Apr 2005 02:56:33 +0000 (02:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_KnuthStylePageBreaking@198580 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/flow/Inline.java
src/java/org/apache/fop/fo/flow/Marker.java
src/java/org/apache/fop/fo/flow/RetrieveMarker.java
src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java

index 82d1db9feebf8a7ad6cdc9d780c8ccde36e3c951..f396c7dc2d7220b1c1572e629778e46c8add7768 100644 (file)
@@ -28,7 +28,6 @@ import org.apache.fop.fo.InlineCharIterator;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.fo.ValidationException;
 import org.apache.fop.fo.properties.CommonRelativePosition;
-import org.apache.fop.fo.properties.CommonTextDecoration;
 import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.fo.properties.LengthRangeProperty;
 
index 96c99b3e45b328560a338f9326cdfc2c09233e97..15fe81aed06a9e4a4bbf4c602971a497da0dfb7d 100644 (file)
@@ -20,8 +20,6 @@ package org.apache.fop.fo.flow;
 
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
 
 
 import org.xml.sax.Locator;
@@ -29,7 +27,6 @@ import org.xml.sax.Locator;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.fo.FOEventHandler;
 import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FOText;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.FObjMixed;
 import org.apache.fop.fo.PropertyList;
@@ -60,7 +57,17 @@ public class Marker extends FObjMixed {
      * @see org.apache.fop.fo.FObj#bind(PropertyList)
      */
     public void bind(PropertyList pList) throws FOPException {
+        if (findAncestor(FO_FLOW) < 0) {
+            invalidChildError(locator, FO_URI, "marker", 
+                "An fo:marker is permitted only as the descendant " +
+                "of an fo:flow");
+        }
+        
         markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString();
+        
+        if (markerClassName == null || markerClassName.equals("")) {
+            missingPropertyError("marker-class-name");
+        }        
     }
     
     /**
index 744728ae20f72bfb5b0f0c0feab01031547f0737..9992d52d6afd85d74342a9af73f91e463fccf8e7 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Map;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.ArrayList;
-import java.util.List;
 
 import org.xml.sax.Locator;
 
@@ -66,9 +65,19 @@ public class RetrieveMarker extends FObjMixed {
      * @see org.apache.fop.fo.FObj#bind(PropertyList)
      */
     public void bind(PropertyList pList) throws FOPException {
+        if (findAncestor(FO_STATIC_CONTENT) < 0) {
+            invalidChildError(locator, FO_URI, "retrieve-marker", 
+                "An fo:retrieve-marker is permitted only as the " +
+                " descendant of an fo:static-content.");
+        }
+
         retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
         retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum();
         retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum();
+        
+        if (retrieveClassName == null || retrieveClassName.equals("")) {
+            missingPropertyError("retrieve-class-name");
+        }        
     }
     
     /**
index 6d2228931b5d163476297cb478eb554508a3b0fe..fceb1c9e08353b2d813e0bb5198ee024dc352f85 100644 (file)
@@ -29,8 +29,6 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
 
-import org.apache.fop.traits.MinOptMax;
-
 /**
  * LayoutManager for an fo:flow object.
  * Its parent LM is the PageSequenceLayoutManager.