You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/04/14 15:06:05 UTC
svn commit: r647787 [2/5] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./
examples/embedding/java/embedding/events/ lib/build/ src/codegen/java/
src/codegen/java/org/ src/codegen/java/org/apache/
src/codegen/java/org/apache/fop/ src/codegen/ja...
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FONode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FONode.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FONode.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FONode.java Mon Apr 14 06:05:52 2008
@@ -21,6 +21,8 @@
// Java
import java.util.ListIterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -29,6 +31,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.extensions.ExtensionAttachment;
@@ -37,6 +41,7 @@
import org.apache.fop.fo.pagination.Root;
import org.apache.fop.util.CharUtilities;
import org.apache.fop.util.ContentHandlerFactory;
+import org.apache.fop.util.text.AdvancedMessageFormat.Function;
/**
* Base class for nodes in the XML tree
@@ -143,6 +148,10 @@
return parent.getFOEventHandler();
}
+ /**
+ * Indicates whether this node is a child of an fo:marker.
+ * @return true if this node is a child of an fo:marker
+ */
protected boolean inMarker() {
return getFOEventHandler().inMarker();
}
@@ -239,7 +248,7 @@
* @param start starting array element to add
* @param end ending array element to add
* @param pList currently applicable PropertyList
- * @param locator location in fo source file.
+ * @param locator location in the XSL-FO source file.
* @throws FOPException if there's a problem during processing
*/
protected void addCharacters(char[] data, int start, int end,
@@ -343,54 +352,50 @@
}
/**
- * Helper function to standardize property error exceptions
- * (e.g., not specifying either an internal- or an external-destination
- * property for an FO:link)
- * @param problem text to display that indicates the problem
- * @throws ValidationException the validation error provoked by the method call
+ * Returns an instance of the FOValidationEventProducer.
+ * @return an event producer for FO validation
*/
- protected void attributeError(String problem)
- throws ValidationException {
- throw new ValidationException(errorText(locator) + getName()
- + ", " + problem, locator);
+ protected FOValidationEventProducer getFOValidationEventProducer() {
+ return FOValidationEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
}
-
+
/**
- * Helper function to standardize attribute warnings
- * (e.g., currently unsupported properties)
- * @param problem text to display that indicates the problem
+ * Helper function to standardize "too many" error exceptions
+ * (e.g., two fo:declarations within fo:root)
+ * @param loc org.xml.sax.Locator object of the error (*not* parent node)
+ * @param nsURI namespace URI of incoming invalid node
+ * @param lName local name (i.e., no prefix) of incoming node
+ * @throws ValidationException the validation error provoked by the method call
*/
- public void attributeWarning(String problem) {
- log.warn(warningText(locator) + getName() + ", " + problem);
+ protected void tooManyNodesError(Locator loc, String nsURI, String lName)
+ throws ValidationException {
+ tooManyNodesError(loc, new QName(nsURI, lName));
}
/**
* Helper function to standardize "too many" error exceptions
* (e.g., two fo:declarations within fo:root)
* @param loc org.xml.sax.Locator object of the error (*not* parent node)
- * @param nsURI namespace URI of incoming invalid node
- * @param lName local name (i.e., no prefix) of incoming node
+ * @param offendingNode the qualified name of the offending node
* @throws ValidationException the validation error provoked by the method call
*/
- protected void tooManyNodesError(Locator loc, String nsURI, String lName)
+ protected void tooManyNodesError(Locator loc, QName offendingNode)
throws ValidationException {
- throw new ValidationException(errorText(loc) + "For " + getName()
- + ", only one " + getNodeString(nsURI, lName) + " may be declared.",
- loc);
+ getFOValidationEventProducer().tooManyNodes(this, getName(), offendingNode, loc);
}
/**
* Helper function to standardize "too many" error exceptions
* (e.g., two fo:declarations within fo:root)
- * This overrloaded method helps make the caller code better self-documenting
+ * This overloaded method helps make the caller code better self-documenting
* @param loc org.xml.sax.Locator object of the error (*not* parent node)
* @param offendingNode incoming node that would cause a duplication.
* @throws ValidationException the validation error provoked by the method call
*/
protected void tooManyNodesError(Locator loc, String offendingNode)
throws ValidationException {
- throw new ValidationException(errorText(loc) + "For " + getName()
- + ", only one " + offendingNode + " may be declared.", loc);
+ tooManyNodesError(loc, new QName(FO_URI, offendingNode));
}
/**
@@ -402,9 +407,23 @@
* @throws ValidationException the validation error provoked by the method call
*/
protected void nodesOutOfOrderError(Locator loc, String tooLateNode,
- String tooEarlyNode) throws ValidationException {
- throw new ValidationException(errorText(loc) + "For " + getName() + ", " + tooLateNode
- + " must be declared before " + tooEarlyNode + ".", loc);
+ String tooEarlyNode) throws ValidationException {
+ nodesOutOfOrderError(loc, tooLateNode, tooEarlyNode, false);
+ }
+
+ /**
+ * Helper function to standardize "out of order" exceptions
+ * (e.g., fo:layout-master-set appearing after fo:page-sequence)
+ * @param loc org.xml.sax.Locator object of the error (*not* parent node)
+ * @param tooLateNode string name of node that should be earlier in document
+ * @param tooEarlyNode string name of node that should be later in document
+ * @param canRecover indicates whether FOP can recover from this problem and continue working
+ * @throws ValidationException the validation error provoked by the method call
+ */
+ protected void nodesOutOfOrderError(Locator loc, String tooLateNode,
+ String tooEarlyNode, boolean canRecover) throws ValidationException {
+ getFOValidationEventProducer().nodeOutOfOrder(this, getName(),
+ tooLateNode, tooEarlyNode, canRecover, loc);
}
/**
@@ -417,24 +436,24 @@
*/
protected void invalidChildError(Locator loc, String nsURI, String lName)
throws ValidationException {
- invalidChildError(loc, nsURI, lName, null);
+ invalidChildError(loc, getName(), nsURI, lName, null);
}
/**
* Helper function to return "invalid child" exceptions with more
* complex validation rules (i.e., needing more explanation of the problem)
* @param loc org.xml.sax.Locator object of the error (*not* parent node)
+ * @param parentName the name of the parent element
* @param nsURI namespace URI of incoming invalid node
* @param lName local name (i.e., no prefix) of incoming node
- * @param ruleViolated text explanation of problem
+ * @param ruleViolated name of the rule violated (used to lookup a resource in a bundle)
* @throws ValidationException the validation error provoked by the method call
*/
- protected void invalidChildError(Locator loc, String nsURI, String lName,
+ protected void invalidChildError(Locator loc, String parentName, String nsURI, String lName,
String ruleViolated)
throws ValidationException {
- throw new ValidationException(errorText(loc) + getNodeString(nsURI, lName)
- + " is not a valid child element of " + getName()
- + ((ruleViolated != null) ? ": " + ruleViolated : "."), loc);
+ getFOValidationEventProducer().invalidChild(this, parentName,
+ new QName(nsURI, lName), ruleViolated, loc);
}
/**
@@ -446,9 +465,22 @@
*/
protected void missingChildElementError(String contentModel)
throws ValidationException {
- throw new ValidationException(errorText(locator) + getName()
- + " is missing child elements. \nRequired Content Model: "
- + contentModel, locator);
+ getFOValidationEventProducer().missingChildElement(this, getName(),
+ contentModel, false, locator);
+ }
+
+ /**
+ * Helper function to throw an error caused by missing mandatory child elements.
+ * E.g., fo:layout-master-set not having any page-master child element.
+ * @param contentModel The XSL Content Model for the fo: object or a similar description
+ * indicating the necessary child elements.
+ * @param canRecover indicates whether FOP can recover from this problem and continue working
+ * @throws ValidationException the validation error provoked by the method call
+ */
+ protected void missingChildElementError(String contentModel, boolean canRecover)
+ throws ValidationException {
+ getFOValidationEventProducer().missingChildElement(this, getName(),
+ contentModel, canRecover, locator);
}
/**
@@ -458,8 +490,7 @@
*/
protected void missingPropertyError(String propertyName)
throws ValidationException {
- throw new ValidationException(errorText(locator) + getName()
- + " is missing required \"" + propertyName + "\" property.", locator);
+ getFOValidationEventProducer().missingProperty(this, getName(), propertyName, locator);
}
/**
@@ -513,9 +544,10 @@
/**
* Returns a String containing as much context information as possible about a node. Call
- * this methods only in exceptional conditions because this method may perform quite extensive
+ * this method only in exceptional conditions because this method may perform quite extensive
* information gathering inside the FO tree.
- * @return a String containing
+ * @return a String containing context information
+ * @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done!
*/
public String getContextInfo() {
StringBuffer sb = new StringBuffer();
@@ -543,6 +575,54 @@
}
/**
+ * Returns a String containing as some context information about a node. It does not take the
+ * locator into consideration and returns null if no useful context information can be found.
+ * Call this method only in exceptional conditions because this method may perform quite
+ * extensive information gathering inside the FO tree. All text returned by this method that
+ * is not extracted from document content needs to be locale-independent.
+ * @return a String containing context information
+ */
+ protected String getContextInfoAlt() {
+ String s = gatherContextInfo();
+ if (s != null) {
+ StringBuffer sb = new StringBuffer();
+ if (getLocalName() != null) {
+ sb.append(getName());
+ sb.append(", ");
+ }
+ sb.append("\"");
+ sb.append(s);
+ sb.append("\"");
+ return sb.toString();
+ } else {
+ return null;
+ }
+ }
+
+ /** Function for AdvancedMessageFormat to retrieve context info from an FONode. */
+ public static class GatherContextInfoFunction implements Function {
+
+ /** {@inheritDoc} */
+ public Object evaluate(Map params) {
+ Object obj = params.get("source");
+ if (obj instanceof PropertyList) {
+ PropertyList propList = (PropertyList)obj;
+ obj = propList.getFObj();
+ }
+ if (obj instanceof FONode) {
+ FONode node = (FONode)obj;
+ return node.getContextInfoAlt();
+ }
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ public Object getName() {
+ return "gatherContextInfo";
+ }
+ }
+
+ /**
* Gathers context information for the getContextInfo() method.
* @return the collected context information or null, if none is available
*/
@@ -687,7 +767,7 @@
* of child nodes
* @return the parent node
*/
- public FObj parentNode();
+ FObj parentNode();
/**
* Convenience method with return type of FONode
@@ -695,7 +775,7 @@
* <code>(FONode) next();</code>)
* @return the next node (if any), as a type FONode
*/
- public FONode nextNode();
+ FONode nextNode();
/**
* Convenience method with return type of FONode
@@ -703,7 +783,7 @@
* <code>(FONode) previous();</code>)
* @return the previous node (if any), as a type FONode
*/
- public FONode previousNode();
+ FONode previousNode();
/**
* Returns the first node in the list, and decreases the index,
@@ -711,7 +791,7 @@
* @return the first node in the list
* @throws NoSuchElementException if the list is empty
*/
- public FONode firstNode();
+ FONode firstNode();
/**
* Returns the last node in the list, and advances the
@@ -720,7 +800,7 @@
* @return the last node in the list
* @throws NoSuchElementException if the list is empty
*/
- public FONode lastNode();
+ FONode lastNode();
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOText.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOText.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOText.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOText.java Mon Apr 14 06:05:52 2008
@@ -19,11 +19,11 @@
package org.apache.fop.fo;
-// Java
import java.awt.Color;
import java.util.NoSuchElementException;
-// FOP
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.flow.Block;
@@ -34,9 +34,6 @@
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.SpaceProperty;
-// SAX
-import org.xml.sax.Locator;
-
/**
* A text node (PCDATA) in the formatting object tree.
*
@@ -396,7 +393,7 @@
return ca[i];
}
default:
- log.warn("Invalid text-tranform value: " + textTransform);
+ assert false; //should never happen as the property subsystem catches that case
return ca[i];
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FOTreeBuilder.java Mon Apr 14 06:05:52 2008
@@ -31,6 +31,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.FormattingResults;
@@ -130,6 +132,7 @@
throw new IllegalStateException("FOTreeBuilder (and the Fop class) cannot be reused."
+ " Please instantiate a new instance.");
}
+
used = true;
empty = true;
rootFObj = null; // allows FOTreeBuilder to be reused
@@ -146,8 +149,10 @@
public void endDocument() throws SAXException {
this.delegate.endDocument();
if (this.rootFObj == null && empty) {
- throw new ValidationException(
- "Document is empty (something might be wrong with your XSLT stylesheet).");
+ FOValidationEventProducer eventProducer
+ = FOValidationEventProducer.Provider.get(
+ foEventHandler.getUserAgent().getEventBroadcaster());
+ eventProducer.emptyDocument(this);
}
rootFObj = null;
if (log.isDebugEnabled()) {
@@ -178,18 +183,6 @@
}
}
- /**
- * Finds the {@link Maker} used to create {@link FONode} objects of a particular type
- *
- * @param namespaceURI URI for the namespace of the element
- * @param localName name of the Element
- * @return the ElementMapping.Maker that can create an FO object for this element
- * @throws FOPException if a Maker could not be found for a bound namespace.
- */
- private Maker findFOMaker(String namespaceURI, String localName) throws FOPException {
- return elementMappingRegistry.findFOMaker(namespaceURI, localName, locator);
- }
-
/** {@inheritDoc} */
public void warning(SAXParseException e) {
log.warn(e.getLocalizedMessage());
@@ -258,22 +251,21 @@
if (rootFObj == null) {
empty = false;
if (!namespaceURI.equals(FOElementMapping.URI)
- || !localName.equals("root")) {
- throw new ValidationException(
- "Error: First element must be the fo:root formatting object. "
- + "Found " + FONode.getNodeString(namespaceURI, localName)
- + " instead."
- + " Please make sure you're producing a valid XSL-FO document.");
+ || !localName.equals("root")) {
+ FOValidationEventProducer eventProducer
+ = FOValidationEventProducer.Provider.get(
+ foEventHandler.getUserAgent().getEventBroadcaster());
+ eventProducer.invalidFORoot(this, FONode.getNodeString(namespaceURI, localName),
+ getEffectiveLocator());
}
} else { // check that incoming node is valid for currentFObj
- if (namespaceURI.equals(FOElementMapping.URI)
- || namespaceURI.equals(ExtensionElementMapping.URI)) {
+ if (currentFObj.getNamespaceURI().equals(FOElementMapping.URI)
+ || currentFObj.getNamespaceURI().equals(ExtensionElementMapping.URI)) {
currentFObj.validateChildNode(locator, namespaceURI, localName);
}
}
- ElementMapping.Maker fobjMaker =
- findFOMaker(namespaceURI, localName);
+ ElementMapping.Maker fobjMaker = findFOMaker(namespaceURI, localName);
try {
foNode = fobjMaker.make(currentFObj);
@@ -342,8 +334,7 @@
if (currentPropertyList != null
&& currentPropertyList.getFObj() == currentFObj
&& !foEventHandler.inMarker()) {
- currentPropertyList =
- currentPropertyList.getParentPropertyList();
+ currentPropertyList = currentPropertyList.getParentPropertyList();
}
if (currentFObj.getNameId() == Constants.FO_MARKER) {
@@ -373,7 +364,29 @@
/** {@inheritDoc} */
public void endDocument() throws SAXException {
currentFObj = null;
- }
+ }
+
+ /**
+ * Finds the {@link Maker} used to create {@link FONode} objects of a particular type
+ *
+ * @param namespaceURI URI for the namespace of the element
+ * @param localName name of the Element
+ * @return the ElementMapping.Maker that can create an FO object for this element
+ * @throws FOPException if a Maker could not be found for a bound namespace.
+ */
+ private Maker findFOMaker(String namespaceURI, String localName) throws FOPException {
+ Maker maker = elementMappingRegistry.findFOMaker(namespaceURI, localName, locator);
+ if (maker instanceof UnknownXMLObj.Maker) {
+ FOValidationEventProducer eventProducer
+ = FOValidationEventProducer.Provider.get(
+ foEventHandler.getUserAgent().getEventBroadcaster());
+ eventProducer.unknownFormattingObject(this, currentFObj.getName(),
+ new QName(namespaceURI, localName),
+ getEffectiveLocator());
+ }
+ return maker;
+ }
+
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/FObj.java Mon Apr 14 06:05:52 2008
@@ -27,13 +27,15 @@
import java.util.NoSuchElementException;
import java.util.Set;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.extensions.ExtensionAttachment;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.fop.util.QName;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
/**
* Base class for representation of formatting objects and their processing.
@@ -171,25 +173,7 @@
if (!idrefs.contains(id)) {
idrefs.add(id);
} else {
- if (getUserAgent().validateStrictly()) {
- throw new ValidationException("Property id \"" + id
- + "\" previously used; id values must be unique"
- + " in document.", locator);
- } else {
- if (log.isWarnEnabled()) {
- StringBuffer msg = new StringBuffer();
- msg.append("Found non-unique id on ").append(getName());
- if (locator.getLineNumber() != -1) {
- msg.append(" (at ").append(locator.getLineNumber())
- .append("/").append(locator.getColumnNumber())
- .append(")");
- }
- msg.append("\nAny reference to it will be considered "
- + "a reference to the first occurrence "
- + "in the document.");
- log.warn(msg);
- }
- }
+ getFOValidationEventProducer().idNotUnique(this, getName(), id, true, locator);
}
}
}
@@ -283,17 +267,23 @@
return false;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public FONodeIterator getChildNodes() {
- if (firstChild != null) {
+ if (hasChildren()) {
return new FObjIterator(this);
}
return null;
}
/**
+ * Indicates whether this formatting object has children.
+ * @return true if there are children
+ */
+ public boolean hasChildren() {
+ return this.firstChild != null;
+ }
+
+ /**
* Return an iterator over the object's childNodes starting
* at the passed-in node (= first call to iterator.next() will
* return childNode)
@@ -348,8 +338,8 @@
if (node instanceof FObj
|| (node instanceof FOText
&& ((FOText) node).willCreateArea())) {
- log.error(
- "fo:marker must be an initial child: " + mcname);
+ getFOValidationEventProducer().markerNotInitialChild(this, getName(),
+ mcname, locator);
return;
} else if (node instanceof FOText) {
iter.remove();
@@ -363,8 +353,8 @@
if (!markers.containsKey(mcname)) {
markers.put(mcname, marker);
} else {
- log.error("fo:marker 'marker-class-name' "
- + "must be unique for same parent: " + mcname);
+ getFOValidationEventProducer().markerNotUniqueForSameParent(this, getName(),
+ mcname, locator);
}
}
@@ -382,6 +372,33 @@
return markers;
}
+ /** {@inheritDoc} */
+ protected String getContextInfoAlt() {
+ StringBuffer sb = new StringBuffer();
+ if (getLocalName() != null) {
+ sb.append(getName());
+ sb.append(", ");
+ }
+ if (hasId()) {
+ sb.append("id=").append(getId());
+ return sb.toString();
+ }
+ String s = gatherContextInfo();
+ if (s != null) {
+ sb.append("\"");
+ if (s.length() < 32) {
+ sb.append(s);
+ } else {
+ sb.append(s.substring(0, 32));
+ sb.append("...");
+ }
+ sb.append("\"");
+ return sb.toString();
+ } else {
+ return null;
+ }
+ }
+
/** {@inheritDoc} */
protected String gatherContextInfo() {
if (getLocator() != null) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/PropertyList.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/PropertyList.java Mon Apr 14 06:05:52 2008
@@ -20,13 +20,13 @@
package org.apache.fop.fo;
// Java
-import java.text.MessageFormat;
-
import org.xml.sax.Attributes;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.apps.FopFactory;
import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
@@ -41,7 +41,6 @@
import org.apache.fop.fo.properties.CommonTextDecoration;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.fop.util.QName;
/**
* Class containing the collection of properties for a given FObj.
@@ -150,7 +149,7 @@
* the default value.
* @param propId The Constants ID of the property whose value is desired.
* @return the Property corresponding to that name
- * @throws PropertyException ...
+ * @throws PropertyException if there is a problem evaluating the property
*/
public Property get(int propId) throws PropertyException {
return get(propId, true, true);
@@ -166,7 +165,7 @@
* value is needed
* @param bTryDefault true when the default value may be used as a last resort
* @return the property
- * @throws PropertyException ...
+ * @throws PropertyException if there is a problem evaluating the property
*/
public Property get(int propId, boolean bTryInherit,
boolean bTryDefault) throws PropertyException {
@@ -321,20 +320,18 @@
} else if (!factory.isNamespaceIgnored(attributeNS)) {
ElementMapping mapping = factory.getElementMappingRegistry().getElementMapping(
attributeNS);
+ QName attr = new QName(attributeNS, attributeName);
if (mapping != null) {
- QName attName = new QName(attributeNS, attributeName);
- if (mapping.isAttributeProperty(attName)
+ if (mapping.isAttributeProperty(attr)
&& mapping.getStandardPrefix() != null) {
convertAttributeToProperty(attributes,
- mapping.getStandardPrefix() + ":" + attName.getLocalName(),
+ mapping.getStandardPrefix() + ":" + attr.getLocalName(),
attributeValue);
} else {
- getFObj().addForeignAttribute(attName, attributeValue);
+ getFObj().addForeignAttribute(attr, attributeValue);
}
} else {
- handleInvalidProperty(
- "Error processing foreign attribute: "
- + attributeNS + "/@" + attributeName, attributeName);
+ handleInvalidProperty(attr);
}
}
}
@@ -345,11 +342,8 @@
* @param propertyName the property name to check
* @return true if the base property name and the subproperty name (if any)
* can be correctly mapped to an id
- * @throws ValidationException in case the property name
- * is invalid for the FO namespace
*/
- protected boolean isValidPropertyName(String propertyName)
- throws ValidationException {
+ protected boolean isValidPropertyName(String propertyName) {
int propId = FOPropertyMapping.getPropertyId(
findBasePropertyName(propertyName));
@@ -359,9 +353,6 @@
if (propId == -1
|| (subpropId == -1
&& findSubPropertyName(propertyName) != null)) {
- String errorMessage = MessageFormat.format(
- "Invalid property name ''{0}''.", new Object[] {propertyName});
- handleInvalidProperty(errorMessage, propertyName);
return false;
}
return true;
@@ -382,19 +373,23 @@
if (attributeValue != null) {
- if (!isValidPropertyName(attributeName)) {
- //will log an error or throw an exception
+ if (attributeName.startsWith("xmlns:")) {
+ //Ignore namespace declarations
return;
}
- FObj parentFO = fobj.findNearestAncestorFObj();
-
/* Handle "compound" properties, ex. space-before.minimum */
String basePropertyName = findBasePropertyName(attributeName);
String subPropertyName = findSubPropertyName(attributeName);
int propId = FOPropertyMapping.getPropertyId(basePropertyName);
int subpropId = FOPropertyMapping.getSubPropertyId(subPropertyName);
+
+ if (propId == -1
+ || (subpropId == -1 && subPropertyName != null)) {
+ handleInvalidProperty(new QName(null, attributeName));
+ }
+ FObj parentFO = fobj.findNearestAncestorFObj();
PropertyMaker propertyMaker = findMaker(propId);
if (propertyMaker == null) {
@@ -417,8 +412,8 @@
}
prop = propertyMaker.make(this, attributeValue, parentFO);
} else { // e.g. "leader-length.maximum"
- Property baseProperty =
- findBaseProperty(attributes, parentFO, propId,
+ Property baseProperty
+ = findBaseProperty(attributes, parentFO, propId,
basePropertyName, propertyMaker);
prop = propertyMaker.make(baseProperty, subpropId,
this, attributeValue, parentFO);
@@ -427,8 +422,8 @@
putExplicit(propId, prop);
}
} catch (PropertyException e) {
- log.error("Ignoring property: "
- + attributeName + "=\"" + attributeValue + "\" (" + e.getMessage() + ")");
+ fobj.getFOValidationEventProducer().invalidPropertyValue(this, fobj.getName(),
+ attributeName, attributeValue, e, fobj.locator);
}
}
}
@@ -465,18 +460,16 @@
}
/**
- * @param message ...
- * @param propName ...
- * @throws ValidationException ...
+ * Handles an invalid property.
+ * @param attr the invalid attribute
+ * @throws ValidationException if an exception needs to be thrown depending on the
+ * validation settings
*/
- protected void handleInvalidProperty(String message, String propName)
+ protected void handleInvalidProperty(QName attr)
throws ValidationException {
- if (!propName.startsWith("xmlns")) {
- if (fobj.getUserAgent().validateStrictly()) {
- fobj.attributeError(message);
- } else {
- log.error(message + " Property ignored.");
- }
+ if (!attr.getQName().startsWith("xmlns")) {
+ fobj.getFOValidationEventProducer().invalidProperty(this, fobj.getName(),
+ attr, true, fobj.locator);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/FromParentFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/FromParentFunction.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/FromParentFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/FromParentFunction.java Mon Apr 14 06:05:52 2008
@@ -64,7 +64,13 @@
* non-inherited properties too. Perhaps the result is different for
* a property line line-height which "inherits specified"???
*/
- return pInfo.getPropertyList().getFromParent(FOPropertyMapping.getPropertyId(propName));
+ int propId = FOPropertyMapping.getPropertyId(propName);
+ if (propId < 0) {
+ throw new PropertyException(
+ "Unknown property name used with inherited-property-value function: "
+ + propName);
+ }
+ return pInfo.getPropertyList().getFromParent(propId);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/InheritedPropFunction.java Mon Apr 14 06:05:52 2008
@@ -58,6 +58,11 @@
}
int propId = FOPropertyMapping.getPropertyId(propName);
+ if (propId < 0) {
+ throw new PropertyException(
+ "Unknown property name used with inherited-property-value function: "
+ + propName);
+ }
return pInfo.getPropertyList().getInherited(propId);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/expr/NearestSpecPropFunction.java Mon Apr 14 06:05:52 2008
@@ -60,6 +60,11 @@
// NOTE: special cases for shorthand property
// Should return COMPUTED VALUE
int propId = FOPropertyMapping.getPropertyId(propName);
+ if (propId < 0) {
+ throw new PropertyException(
+ "Unknown property name used with inherited-property-value function: "
+ + propName);
+ }
return pInfo.getPropertyList().getNearestSpecified(propId);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java Mon Apr 14 06:05:52 2008
@@ -19,14 +19,15 @@
package org.apache.fop.fo.extensions;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.fo.ElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.UnknownXMLObj;
import org.apache.fop.fo.extensions.destination.Destination;
-import org.apache.fop.util.QName;
-
-import java.util.HashMap;
-import java.util.Set;
/**
* Element mapping for FOP's proprietary extension to XSL-FO.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/destination/Destination.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/destination/Destination.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/destination/Destination.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/extensions/destination/Destination.java Mon Apr 14 06:05:52 2008
@@ -19,15 +19,15 @@
package org.apache.fop.fo.extensions.destination;
-import org.apache.fop.fo.ValidationException;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.pagination.Root;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
+import org.apache.fop.fo.pagination.Root;
/**
* Class for named destinations in PDF.
@@ -54,7 +54,7 @@
Attributes attlist, PropertyList pList) throws FOPException {
internalDestination = attlist.getValue("internal-destination");
if (internalDestination == null || internalDestination.length() == 0) {
- attributeError("Missing attribute: internal-destination must be specified.");
+ missingPropertyError("internal-destination");
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java Mon Apr 14 06:05:52 2008
@@ -62,14 +62,16 @@
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
}
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
}
}
@@ -79,17 +81,8 @@
protected void endOfNode() throws FOPException {
if (!this.blockItemFound) {
String contentModel = "marker* (%block;)+";
- if (getUserAgent().validateStrictly()) {
- missingChildElementError(contentModel);
- } else {
- StringBuffer message = new StringBuffer(
- errorText(getLocator()));
- message.append(getName())
- .append(" is missing child elements. ")
- .append("Required Content Model: ")
- .append(contentModel);
- log.warn(message.toString());
- }
+ getFOValidationEventProducer().missingChildElement(this, getName(),
+ contentModel, true, getLocator());
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java Mon Apr 14 06:05:52 2008
@@ -113,8 +113,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/** @return the Common Font Properties. */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BasicLink.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BasicLink.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BasicLink.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BasicLink.java Mon Apr 14 06:05:52 2008
@@ -76,8 +76,7 @@
externalDestination = null;
} else if (externalDestination.length() == 0) {
// slightly stronger than spec "should be specified"
- attributeError("Missing attribute: Either external-destination or " +
- "internal-destination must be specified.");
+ getFOValidationEventProducer().missingLinkDestination(this, getName(), locator);
}
}
@@ -102,15 +101,17 @@
* XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockOrInlineItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(#PCDATA|%inline;|%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockOrInlineItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(#PCDATA|%inline;|%block;)");
+ }
+ } else if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockOrInlineItemFound = true;
}
- } else if (!isBlockOrInlineItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockOrInlineItemFound = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BidiOverride.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BidiOverride.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BidiOverride.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BidiOverride.java Mon Apr 14 06:05:52 2008
@@ -19,13 +19,14 @@
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.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.SpaceProperty;
-import org.xml.sax.Locator;
/**
* Class modelling the fo:bidi-override object.
@@ -96,22 +97,21 @@
* fo:inline-container."
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockOrInlineItemFound) {
- nodesOutOfOrderError(loc, "fo:marker",
- "(#PCDATA|%inline;|%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockOrInlineItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker",
+ "(#PCDATA|%inline;|%block;)");
+ }
+ } else if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, getParent().getName(), nsURI, getName(),
+ "rule.bidiOverrideContent");
+ } else {
+ blockOrInlineItemFound = true;
}
- } else if (!isBlockOrInlineItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
- String ruleViolated = "An fo:bidi-override"
- + " that is a descendant of an fo:leader or of the fo:inline child"
- + " of an fo:footnote may not have block-level children, unless it"
- + " has a nearer ancestor that is an fo:inline-container.";
- invalidChildError(loc, nsURI, localName, ruleViolated);
- } else {
- blockOrInlineItemFound = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BlockContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BlockContainer.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BlockContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/BlockContainer.java Mon Apr 14 06:05:52 2008
@@ -114,15 +114,17 @@
* @todo - implement above restriction if possible
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
}
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Character.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Character.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Character.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Character.java Mon Apr 14 06:05:52 2008
@@ -22,6 +22,8 @@
import java.awt.Color;
import java.util.NoSuchElementException;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.CharIterator;
@@ -35,7 +37,6 @@
import org.apache.fop.fo.properties.CommonTextDecoration;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.SpaceProperty;
-import org.xml.sax.Locator;
/**
* Class modelling the fo:character object.
@@ -134,8 +135,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ExternalGraphic.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ExternalGraphic.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ExternalGraphic.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ExternalGraphic.java Mon Apr 14 06:05:52 2008
@@ -32,6 +32,7 @@
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.URISpecification;
+import org.apache.fop.events.ResourceEventProducer;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
@@ -78,11 +79,17 @@
try {
info = manager.getImageInfo(url, userAgent.getImageSessionContext());
} catch (ImageException e) {
- log.error("Image not available: " + e.getMessage());
+ ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.imageError(this, url, e, getLocator());
} catch (FileNotFoundException fnfe) {
- log.error(fnfe.getMessage());
+ ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.imageNotFound(this, url, fnfe, getLocator());
} catch (IOException ioe) {
- log.error("I/O error while loading image: " + ioe.getMessage());
+ ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.imageIOError(this, url, ioe, getLocator());
}
if (info != null) {
this.intrinsicWidth = info.getSize().getWidthMpt();
@@ -93,7 +100,6 @@
= FixedLength.getInstance(-baseline);
}
}
- //TODO Report to caller so he can decide to throw an exception
}
/** {@inheritDoc} */
@@ -107,8 +113,10 @@
* <br>XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/** @return the "src" property */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Float.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Float.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Float.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Float.java Mon Apr 14 06:05:52 2008
@@ -46,7 +46,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:float is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
@@ -63,10 +64,12 @@
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
+ }
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Footnote.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Footnote.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Footnote.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Footnote.java Mon Apr 14 06:05:52 2008
@@ -82,12 +82,13 @@
* generates an absolutely positioned area.
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("inline")) {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("inline")) {
if (footnoteCitation != null) {
tooManyNodesError(loc, "fo:inline");
}
- } else if (FO_URI.equals(nsURI) && localName.equals("footnote-body")) {
+ } else if (localName.equals("footnote-body")) {
if (footnoteCitation == null) {
nodesOutOfOrderError(loc, "fo:inline", "fo:footnote-body");
} else if (footnoteBody != null) {
@@ -96,6 +97,7 @@
} else {
invalidChildError(loc, nsURI, localName);
}
+ }
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/FootnoteBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/FootnoteBody.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/FootnoteBody.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/FootnoteBody.java Mon Apr 14 06:05:52 2008
@@ -73,10 +73,12 @@
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
+ }
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InitialPropertySet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InitialPropertySet.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InitialPropertySet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InitialPropertySet.java Mon Apr 14 06:05:52 2008
@@ -72,8 +72,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Inline.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Inline.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Inline.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Inline.java Mon Apr 14 06:05:52 2008
@@ -81,8 +81,8 @@
int lvlInCntr = findAncestor(FO_INLINE_CONTAINER);
if (lvlLeader > 0) {
- if (lvlInCntr < 0 ||
- (lvlInCntr > 0 && lvlInCntr > lvlLeader)) {
+ if (lvlInCntr < 0
+ || (lvlInCntr > 0 && lvlInCntr > lvlLeader)) {
canHaveBlockLevelChildren = false;
}
} else if (lvlFootnote > 0) {
@@ -110,23 +110,20 @@
* nearer ancestor that is an fo:inline-container." (paraphrased)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockOrInlineItemFound) {
- nodesOutOfOrderError(loc, "fo:marker",
- "(#PCDATA|%inline;|%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockOrInlineItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker",
+ "(#PCDATA|%inline;|%block;)");
+ }
+ } else if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, getParent().getName(), nsURI, getName(), "rule.inlineContent");
+ } else {
+ blockOrInlineItemFound = true;
}
- } else if (!isBlockOrInlineItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
- String ruleViolated =
- " An fo:inline that is a descendant of an fo:leader" +
- " or fo:footnote may not have block-level children," +
- " unless it has a nearer ancestor that is an" +
- " fo:inline-container.";
- invalidChildError(loc, nsURI, localName, ruleViolated);
- } else {
- blockOrInlineItemFound = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InlineContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InlineContainer.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InlineContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InlineContainer.java Mon Apr 14 06:05:52 2008
@@ -86,15 +86,17 @@
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (blockItemFound) {
- nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (blockItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
+ }
+ } else if (!isBlockItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ } else {
+ blockItemFound = true;
}
- } else if (!isBlockItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
- } else {
- blockItemFound = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java Mon Apr 14 06:05:52 2008
@@ -20,12 +20,17 @@
package org.apache.fop.fo.flow;
import java.awt.geom.Point2D;
+
+import org.xml.sax.Locator;
+
+import org.apache.xmlgraphics.util.QName;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.events.ResourceEventProducer;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.XMLObj;
-import org.xml.sax.Locator;
/**
* Class modelling the fo:instream-foreign-object object.
@@ -39,6 +44,7 @@
//Additional value
private Point2D intrinsicDimensions;
+ private boolean instrisicSizeDetermined;
private Length intrinsicAlignmentAdjust;
@@ -68,11 +74,11 @@
* XSL Content Model: one (1) non-XSL namespace child
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
} else if (firstChild != null) {
- tooManyNodesError(loc, "child element");
+ tooManyNodesError(loc, new QName(nsURI, null, localName));
}
}
@@ -81,32 +87,28 @@
return "instream-foreign-object";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_INSTREAM_FOREIGN_OBJECT;
}
- /**
- * Preloads the image so the intrinsic size is available.
- */
+ /** Preloads the image so the intrinsic size is available. */
private void prepareIntrinsicSize() {
- if (intrinsicDimensions == null) {
+ if (!this.instrisicSizeDetermined) {
XMLObj child = (XMLObj) firstChild;
Point2D csize = new Point2D.Float(-1, -1);
intrinsicDimensions = child.getDimension(csize);
if (intrinsicDimensions == null) {
- log.error("Intrinsic dimensions of "
- + " instream-foreign-object could not be determined");
+ ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster());
+ eventProducer.ifoNoIntrinsicSize(this, getLocator());
}
intrinsicAlignmentAdjust = child.getIntrinsicAlignmentAdjust();
+ this.instrisicSizeDetermined = true;
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getIntrinsicWidth() {
prepareIntrinsicSize();
if (intrinsicDimensions != null) {
@@ -116,9 +118,7 @@
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getIntrinsicHeight() {
prepareIntrinsicSize();
if (intrinsicDimensions != null) {
@@ -128,11 +128,8 @@
}
}
- /**
- * {@inheritDoc}
- */
- public Length getIntrinsicAlignmentAdjust()
- {
+ /** {@inheritDoc} */
+ public Length getIntrinsicAlignmentAdjust() {
prepareIntrinsicSize();
return intrinsicAlignmentAdjust;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListBlock.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListBlock.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListBlock.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListBlock.java Mon Apr 14 06:05:52 2008
@@ -108,15 +108,17 @@
* XSL Content Model: marker* (list-item)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (hasListItem) {
- nodesOutOfOrderError(loc, "fo:marker", "fo:list-item");
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (hasListItem) {
+ nodesOutOfOrderError(loc, "fo:marker", "fo:list-item");
+ }
+ } else if (localName.equals("list-item")) {
+ hasListItem = true;
+ } else {
+ invalidChildError(loc, nsURI, localName);
}
- } else if (FO_URI.equals(nsURI) && localName.equals("list-item")) {
- hasListItem = true;
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListItem.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListItem.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListItem.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/ListItem.java Mon Apr 14 06:05:52 2008
@@ -98,22 +98,24 @@
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("marker")) {
- if (label != null) {
- nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label");
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("marker")) {
+ if (label != null) {
+ nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label");
+ }
+ } else if (localName.equals("list-item-label")) {
+ if (label != null) {
+ tooManyNodesError(loc, "fo:list-item-label");
+ }
+ } else if (localName.equals("list-item-body")) {
+ if (label == null) {
+ nodesOutOfOrderError(loc, "fo:list-item-label", "fo:list-item-body");
+ } else if (body != null) {
+ tooManyNodesError(loc, "fo:list-item-body");
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
}
- } else if (FO_URI.equals(nsURI) && localName.equals("list-item-label")) {
- if (label != null) {
- tooManyNodesError(loc, "fo:list-item-label");
- }
- } else if (FO_URI.equals(nsURI) && localName.equals("list-item-body")) {
- if (label == null) {
- nodesOutOfOrderError(loc, "fo:list-item-label", "fo:list-item-body");
- } else if (body != null) {
- tooManyNodesError(loc, "fo:list-item-body");
- }
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Marker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Marker.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Marker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Marker.java Mon Apr 14 06:05:52 2008
@@ -59,9 +59,8 @@
*/
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");
+ invalidChildError(locator, getParent().getName(), FO_URI, getName(),
+ "rule.markerDescendantOfFlow");
}
markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString();
@@ -112,9 +111,11 @@
* @todo implement "additional" constraint, possibly within fo:retrieve-marker
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!isBlockOrInlineItem(nsURI, localName)) {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiCase.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiCase.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiCase.java Mon Apr 14 06:05:52 2008
@@ -46,7 +46,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:multi-case is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiProperties.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiProperties.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiProperties.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiProperties.java Mon Apr 14 06:05:52 2008
@@ -49,7 +49,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:multi-properties is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
@@ -69,13 +70,14 @@
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
- if (FO_URI.equals(nsURI) && localName.equals("multi-property-set")) {
+ if (FO_URI.equals(nsURI)) {
+ if (localName.equals("multi-property-set")) {
if (hasWrapper) {
nodesOutOfOrderError(loc, "fo:multi-property-set", "fo:wrapper");
} else {
hasMultiPropertySet = true;
}
- } else if (FO_URI.equals(nsURI) && localName.equals("wrapper")) {
+ } else if (localName.equals("wrapper")) {
if (hasWrapper) {
tooManyNodesError(loc, "fo:wrapper");
} else {
@@ -84,6 +86,7 @@
} else {
invalidChildError(loc, nsURI, localName);
}
+ }
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiPropertySet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiPropertySet.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiPropertySet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiPropertySet.java Mon Apr 14 06:05:52 2008
@@ -45,7 +45,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:multi-property-set is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
@@ -63,8 +64,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiSwitch.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiSwitch.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiSwitch.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiSwitch.java Mon Apr 14 06:05:52 2008
@@ -47,7 +47,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:multi-switch is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
@@ -75,9 +76,11 @@
* XSL Content Model: (multi-case+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
- if (!(FO_URI.equals(nsURI) && localName.equals("multi-case"))) {
- invalidChildError(loc, nsURI, localName);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!localName.equals("multi-case")) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiToggle.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiToggle.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiToggle.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/MultiToggle.java Mon Apr 14 06:05:52 2008
@@ -47,7 +47,8 @@
super(parent);
if (!notImplementedWarningGiven) {
- log.warn("fo:multi-toggle is not yet implemented.");
+ getFOValidationEventProducer().unimplementedFeature(this, getName(),
+ getName(), getLocator());
notImplementedWarningGiven = true;
}
}
@@ -65,9 +66,11 @@
* 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);
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if (!isBlockOrInlineItem(nsURI, localName)) {
+ invalidChildError(loc, nsURI, localName);
+ }
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/PageNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/PageNumber.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/PageNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/PageNumber.java Mon Apr 14 06:05:52 2008
@@ -117,8 +117,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/** @return the Common Font Properties. */
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Mon Apr 14 06:05:52 2008
@@ -21,6 +21,8 @@
import java.util.Iterator;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
@@ -30,7 +32,6 @@
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.flow.table.Table;
import org.apache.fop.fo.flow.table.TableFObj;
-import org.xml.sax.Locator;
/**
* Class modelling the fo:retrieve-marker object.
@@ -48,21 +49,18 @@
/**
* Create a retrieve marker object.
- *
+ * @param parent FONode that is the parent of this object
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public RetrieveMarker(FONode parent) {
super(parent);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
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.");
+ invalidChildError(locator, getParent().getName(), FO_URI, getName(),
+ "rule.retrieveMarkerDescendatOfStaticContent");
}
retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
@@ -81,8 +79,10 @@
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws ValidationException {
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
invalidChildError(loc, nsURI, localName);
+ }
}
/**
@@ -206,13 +206,12 @@
try {
cloneFromMarker(marker);
} catch (FOPException exc) {
- log.error("fo:retrieve-marker unable to clone "
- + "subtree of fo:marker (marker-class-name="
- + marker.getMarkerClassName() + ")", exc);
+ getFOValidationEventProducer().markerCloningFailed(this,
+ marker.getMarkerClassName(), exc, getLocator());
return;
}
- } else if (log.isInfoEnabled()) {
- log.info("Empty marker retrieved...");
+ } else if (log.isDebugEnabled()) {
+ log.debug("Empty marker retrieved...");
}
return;
}
@@ -222,9 +221,7 @@
return "retrieve-marker";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getNameId() {
return FO_RETRIEVE_MARKER;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Wrapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Wrapper.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Wrapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/Wrapper.java Mon Apr 14 06:05:52 2008
@@ -19,12 +19,13 @@
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.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.xml.sax.Locator;
/**
* Class modelling the fo:wrapper object.
@@ -66,17 +67,19 @@
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
- if (FO_URI.equals(nsURI) && "marker".equals(localName)) {
- if (blockOrInlineItemFound) {
- nodesOutOfOrderError(loc, "fo:marker",
- "(#PCDATA|%inline;|%block;)");
+ if (FO_URI.equals(nsURI)) {
+ if ("marker".equals(localName)) {
+ if (blockOrInlineItemFound) {
+ nodesOutOfOrderError(loc, "fo:marker",
+ "(#PCDATA|%inline;|%block;)");
+ }
+ } else if (isBlockOrInlineItem(nsURI, localName)) {
+ //delegate validation to parent
+ FONode.validateChildNode(this.parent, loc, nsURI, localName);
+ blockOrInlineItemFound = true;
+ } else {
+ invalidChildError(loc, nsURI, localName);
}
- } else if (isBlockOrInlineItem(nsURI, localName)) {
- //delegate validation to parent
- FONode.validateChildNode(this.parent, loc, nsURI, localName);
- blockOrInlineItemFound = true;
- } else {
- invalidChildError(loc, nsURI, localName);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java?rev=647787&r1=647786&r2=647787&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/fo/flow/table/FixedColRowGroupBuilder.java Mon Apr 14 06:05:52 2008
@@ -120,13 +120,17 @@
void endTableRow() {
assert currentTableRow != null;
if (currentRowIndex > 0 && currentTableRow.getBreakBefore() != Constants.EN_AUTO) {
- currentTableRow.attributeWarning("break-before ignored because of row spanning "
- + "in progress (See XSL 1.1, 7.20.2)");
+ TableEventProducer eventProducer = TableEventProducer.Provider.get(
+ currentTableRow.getUserAgent().getEventBroadcaster());
+ eventProducer.breakIgnoredDueToRowSpanning(this, currentTableRow.getName(), true,
+ currentTableRow.getLocator());
}
if (currentRowIndex < rows.size() - 1
&& currentTableRow.getBreakAfter() != Constants.EN_AUTO) {
- currentTableRow.attributeWarning("break-after ignored because of row spanning "
- + "in progress (See XSL 1.1, 7.20.1)");
+ TableEventProducer eventProducer = TableEventProducer.Provider.get(
+ currentTableRow.getUserAgent().getEventBroadcaster());
+ eventProducer.breakIgnoredDueToRowSpanning(this, currentTableRow.getName(), false,
+ currentTableRow.getLocator());
}
for (Iterator iter = ((List) rows.get(currentRowIndex)).iterator(); iter.hasNext();) {
GridUnit gu = (GridUnit) iter.next();
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org