import java.awt.Dimension;
import java.awt.geom.Point2D;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
import org.apache.batik.svggen.SVGGraphics2D;
import org.apache.batik.dom.svg.SVGDOMImplementation;
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws SAXParseException {
+ Attributes attlist) throws FOPException {
super.processNode(elementName, locator, attlist);
createBasicDocument();
}
import java.awt.geom.Point2D;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
/**
* This class defines the plan element.
*/
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList propertyList)
- throws SAXParseException
+ throws FOPException
{
super.processNode(elementName, locator, attlist, propertyList);
createBasicDocument();
package org.apache.fop.apps;
+import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
* Exception thrown when FOP has a problem.
*/
-public class FOPException extends Exception {
+public class FOPException extends SAXException {
private static final String EXCEPTION_SEPARATOR = "\n---------\n";
- private Throwable exception;
private String systemId;
private int line;
private int column;
this.column = column;
}
+ public FOPException(String message, Locator locator) {
+ super(message);
+ setLocator(locator);
+ }
+
+
/**
*
* @param e Throwable object
*/
- public FOPException(Throwable e) {
- super(e.getMessage());
- setException(e);
+ public FOPException(Exception e) {
+ super(e);
}
/**
*/
public FOPException(String message, Throwable e) {
super(message);
- setException(e);
- }
-
- /**
- * Sets exception
- * @param t Throwable object
- */
- protected void setException(Throwable t) {
- exception = t;
}
- /**
- * Accessor for exception
- * @return exception
- */
- public Throwable getException() {
- return exception;
+ public void setLocator(Locator locator) {
+ if (locator != null) {
+ this.systemId = locator.getSystemId();
+ this.line = locator.getLineNumber();
+ this.column = locator.getColumnNumber();
+ }
}
public void setLocation(String systemId, int line, int column) {
}
public boolean isLocationSet() {
- return line>=0;
+ return line > 0;
+ }
+
+ public String getMessage() {
+ if (isLocationSet()) {
+ return systemId + ":" + line + "," + column + " " + super.getMessage();
+ } else {
+ return super.getMessage();
+ }
}
/**
* @return the exception recast as another type if possible, otherwise null.
*/
protected Throwable getRootException() {
- Throwable result = exception;
+ Throwable result = getException();
if (result instanceof SAXException) {
result = ((SAXException)result).getException();
result =
((java.lang.reflect.InvocationTargetException)result).getTargetException();
}
- if (result != exception) {
+ if (result != getException()) {
return result;
}
return null;
public void printStackTrace() {
synchronized (System.err) {
super.printStackTrace();
- if (exception != null) {
+ if (getException() != null) {
System.err.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace();
+ getException().printStackTrace();
}
if (getRootException() != null) {
System.err.println(EXCEPTION_SEPARATOR);
public void printStackTrace(java.io.PrintStream stream) {
synchronized (stream) {
super.printStackTrace(stream);
- if (exception != null) {
+ if (getException() != null) {
stream.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace(stream);
+ getException().printStackTrace(stream);
}
if (getRootException() != null) {
stream.println(EXCEPTION_SEPARATOR);
public void printStackTrace(java.io.PrintWriter writer) {
synchronized (writer) {
super.printStackTrace(writer);
- if (exception != null) {
+ if (getException() != null) {
writer.println(EXCEPTION_SEPARATOR);
- exception.printStackTrace(writer);
+ getException().printStackTrace(writer);
}
if (getRootException() != null) {
writer.println(EXCEPTION_SEPARATOR);
package org.apache.fop.datatypes;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Models a length which can be used as a factor in a percentage length
/**
* @return the base length (in millipoints ??) of this object
*/
- public int getBaseLength() {
+ public int getBaseLength() throws PropertyException {
switch (iBaseType) {
case FONTSIZE:
return propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue();
package org.apache.fop.datatypes;
+import org.apache.fop.fo.expr.PropertyException;
+
/**
* Interface for objects that can be used as base objects for percentage
* computations
* which a percentage will be applied to compute the length of the
* referencing item)
*/
- int getBaseLength();
+ int getBaseLength() throws PropertyException;
}
// Java
import java.util.List;
import java.util.ListIterator;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-// XML
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.util.CharUtilities;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.svg.SVGElementMapping;
+import org.apache.fop.util.CharUtilities;
/**
* base class for nodes in the XML tree
* @param elementName element name (e.g., "fo:block")
* @param locator Locator object (ignored by default)
* @param attlist Collection of attributes passed to us from the parser.
- * @throws SAXParseException for errors or inconsistencies in the attributes
+ * @throws FOPException for errors or inconsistencies in the attributes
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList parent) throws SAXParseException {
+ Attributes attlist, PropertyList parent) throws FOPException {
System.out.println("name = " + elementName);
}
* instance can be found.
* @return A new property list.
*/
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
return null;
}
* called within FObj constructor
* @param namespaceURI namespace of incoming node
* @param localName (e.g. "table" for "fo:table")
- * @throws SAXParseException if incoming node not valid for parent
+ * @throws ValidationException if incoming node not valid for parent
*/
protected void validateChildNode(Locator loc, String namespaceURI, String localName)
- throws SAXParseException {}
+ throws ValidationException {}
/**
* Adds characters (does nothing here)
*/
protected void addCharacters(char data[], int start, int length,
PropertyList pList,
- Locator locator) throws SAXParseException {
+ Locator locator) throws FOPException {
// ignore
}
/**
*
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
// do nothing by default
}
/**
*
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
// do nothing by default
}
/**
* @param child child node to be added to the childNodes of this node
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
}
/**
* @param offendingNode incoming node that would cause a duplication.
*/
protected void attributeError(String problem)
- throws SAXParseException {
- throw new SAXParseException (errorText(locator) + getName() + ", " +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() + ", " +
problem, locator);
}
* @param lName local name (i.e., no prefix) of incoming node
*/
protected void tooManyNodesError(Locator loc, String nsURI, String lName)
- throws SAXParseException {
- throw new SAXParseException (errorText(loc) + getName() + ", only one "
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getName() + ", only one "
+ getNodeString(nsURI, lName) + " may be declared.", loc);
}
* @param offendingNode incoming node that would cause a duplication.
*/
protected void tooManyNodesError(Locator loc, String offendingNode)
- throws SAXParseException {
- throw new SAXParseException (errorText(loc) + getName() + ", only one "
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getName() + ", only one "
+ offendingNode + " may be declared.", loc);
}
* @param tooEarlyNode string name of node that should be later in document
*/
protected void nodesOutOfOrderError(Locator loc, String tooLateNode,
- String tooEarlyNode) throws SAXParseException {
- throw new SAXParseException (errorText(loc) + "For " + getName() + ", " + tooLateNode
+ String tooEarlyNode) throws ValidationException {
+ throw new ValidationException(errorText(loc) + "For " + getName() + ", " + tooLateNode
+ " must be declared before " + tooEarlyNode + ".", loc);
}
* @param lName local name (i.e., no prefix) of incoming node
*/
protected void invalidChildError(Locator loc, String nsURI, String lName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, lName, null);
}
*/
protected void invalidChildError(Locator loc, String nsURI, String lName,
String ruleViolated)
- throws SAXParseException {
- throw new SAXParseException (errorText(loc) + getNodeString(nsURI, lName) +
+ throws ValidationException {
+ throw new ValidationException(errorText(loc) + getNodeString(nsURI, lName) +
" is not a valid child element of " + getName()
+ ((ruleViolated != null) ? ": " + ruleViolated : "."), loc);
}
* or a similar description indicating child elements needed.
*/
protected void missingChildElementError(String contentModel)
- throws SAXParseException {
- throw new SAXParseException(errorText(locator) + getName() +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() +
" is missing child elements. \nRequired Content Model: "
+ contentModel, locator);
}
* or a similar description indicating child elements needed.
*/
protected void missingPropertyError(String propertyName)
- throws SAXParseException {
- throw new SAXParseException(errorText(locator) + getName() +
+ throws ValidationException {
+ throw new ValidationException(errorText(locator) + getName() +
" is missing required \"" + propertyName + "\" property.", locator);
}
import java.util.Map;
import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.BorderWidthPropertyMaker;
import org.apache.fop.fo.properties.BoxPropShorthandParser;
import org.apache.fop.fo.properties.CharacterProperty;
// text-align-last
m = new EnumProperty.Maker(PR_TEXT_ALIGN_LAST) {
- public Property compute(PropertyList propertyList) {
+ public Property compute(PropertyList propertyList) throws PropertyException {
Property corresponding = propertyList.get(PR_TEXT_ALIGN);
if (corresponding == null) {
return null;
import java.util.NoSuchElementException;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.pagination.Root;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonFont = pList.getFontProps();
commonHyphenation = pList.getHyphenationProps();
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
public void characters(char[] data, int start, int length)
- throws SAXParseException {
+ throws FOPException {
if (currentFObj != null) {
currentFObj.addCharacters(data, start, start + length, currentPropertyList, locator);
}
namespaceURI.equals(ExtensionElementMapping.URI)) {
try {
currentFObj.validateChildNode(locator, namespaceURI, localName);
- } catch (SAXParseException e) {
+ } catch (ValidationException e) {
+ // TODO: add relaxed validation.
throw e;
}
}
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String rawName)
- throws SAXParseException {
- try {
- currentFObj.endOfNode();
- } catch (SAXParseException e) {
- throw e;
- }
+ throws FOPException {
+ currentFObj.endOfNode();
if (currentPropertyList.getFObj() == currentFObj) {
currentPropertyList = currentPropertyList.getParentPropertyList();
* @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 SAXParseException if a Maker could not be found for a bound namespace.
+ * @throws FOPException if a Maker could not be found for a bound namespace.
*/
- private Maker findFOMaker(String namespaceURI, String localName) throws SAXParseException {
+ private Maker findFOMaker(String namespaceURI, String localName) throws FOPException {
Map table = (Map)fobjTable.get(namespaceURI);
Maker fobjMaker = null;
if (table != null) {
if (fobjMaker == null) {
if (namespaces.contains(namespaceURI.intern())) {
- throw new SAXParseException (FONode.errorText(locator) +
+ throw new FOPException(FONode.errorText(locator) +
"No element mapping definition found for "
+ FONode.getNodeString(namespaceURI, localName), locator);
} else {
import java.util.Map;
import java.util.Set;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.properties.PropertyMaker;
-
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
/**
* Base class for representation of formatting objects and their processing.
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList pList) throws SAXParseException {
+ Attributes attlist, PropertyList pList) throws FOPException {
setLocator(locator);
pList.addAttributesToList(attlist);
pList.setWritingMode();
/**
* Create a default property list for this element.
*/
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
return foEventHandler.getPropertyListMaker().make(this, parent);
}
* Bind property values from the property list to the FO node.
* Must be overriden in all FObj subclasses.
* @param pList the PropertyList where the properties can be found.
- * @throws SAXParseException
+ * @throws FOPException
*/
- public void bind(PropertyList pList) throws SAXParseException {
-// throw new SAXParseException("Unconverted element " + this, locator);
+ public void bind(PropertyList pList) throws FOPException {
+// throw new ValidationException("Unconverted element " + this, locator);
}
/**
* This methods checks that the id isn't already used by another
* fo and sets the id attribute of this object.
*/
- protected void checkId(String id) throws SAXParseException {
+ protected void checkId(String id) throws ValidationException {
if (!id.equals("")) {
Set idrefs = getFOEventHandler().getIDReferences();
if (!idrefs.contains(id)) {
idrefs.add(id);
} else {
- throw new SAXParseException("Property id \"" + id +
+ throw new ValidationException("Property id \"" + id +
"\" previously used; id values must be unique" +
" in document.", locator);
}
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (PropertySets.canHaveMarkers(getNameId()) &&
child.getNameId() == FO_MARKER) {
addMarker((Marker) child);
package org.apache.fop.fo;
import java.util.List;
+
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
+
+import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
/**
*/
protected void addCharacters(char data[], int start, int length,
PropertyList pList,
- Locator locator) throws SAXParseException {
+ Locator locator) throws FOPException {
FOText ft = new FOText(data, start, length, this);
ft.setLocator(locator);
ft.bind(pList);
// Java
import org.xml.sax.Attributes;
-// FOP
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Class containing the collection of properties for a given FObj.
*/
* @return The value if the property is explicitly set or set by
* a shorthand property, otherwise null.
*/
- public Property getExplicitOrShorthand(int propId) {
+ public Property getExplicitOrShorthand(int propId) throws PropertyException {
/* Handle request for one part of a compound property */
Property p = getExplicit(propId);
if (p == null) {
* @param propId The ID of the property whose value is desired.
* @return The inherited value, otherwise null.
*/
- public Property getInherited(int propId) {
+ public Property getInherited(int propId) throws PropertyException {
if (isInherited(propId)) {
return getFromParent(propId);
} else {
// return the "initial" value
- try {
- return makeProperty(propId);
- } catch (org.apache.fop.apps.FOPException e) {
- //log.error("Exception in getInherited(): property="
- // + propertyName + " : " + e);
- }
+ return makeProperty(propId);
}
- return null; // Exception in makeProperty!
}
/**
* @param propId The Constants ID of the property whose value is desired.
* @return the Property corresponding to that name
*/
- public Property get(int propId) {
+ public Property get(int propId) throws PropertyException {
return get(propId, true, true);
}
* the default value.
*/
public Property get(int propId, boolean bTryInherit,
- boolean bTryDefault) {
+ boolean bTryDefault) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId & Constants.PROPERTY_MASK);
- try {
- return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
+ return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
bTryInherit, bTryDefault);
- } catch (FOPException exc) {
- fobj.getLogger().error("Error during property processing", exc);
- }
- return null;
}
/**
* @return The computed value if the property is explicitly set on some
* ancestor of the current FO, else the initial value.
*/
- public Property getNearestSpecified(int propId) {
+ public Property getNearestSpecified(int propId) throws PropertyException {
Property p = null;
for (PropertyList plist = this; p == null && plist != null;
if (p == null) {
// If no explicit setting found, return initial (default) value.
- try {
- p = makeProperty(propId);
- } catch (FOPException e) {
- //log.error("Exception in getNearestSpecified(): property="
- // + propertyName + " : " + e);
- }
+ p = makeProperty(propId);
}
return p;
}
* @return The computed value on the parent or the initial value if this
* FO is the root or is in a different namespace from its parent.
*/
- public Property getFromParent(int propId) {
+ public Property getFromParent(int propId) throws PropertyException {
if (parentPropertyList != null) {
return parentPropertyList.get(propId);
} else {
- try {
- return makeProperty(propId);
- } catch (org.apache.fop.apps.FOPException e) {
- //log.error("Exception in getFromParent(): property="
- // + propertyName + " : " + e);
- }
+ return makeProperty(propId);
}
- return null; // Exception in makeProperty!
}
/**
* Use that from the nearest ancestor, including self, which generates
* reference areas, or from root FO if no ancestor found.
*/
- protected void setWritingMode() {
+ protected void setWritingMode() throws PropertyException {
FObj p = fobj.findNearestAncestorFObj();
// If this is a RA or the root, use the property value.
if (fobj.generatesReferenceAreas() || p == null) {
if (prop != null) {
putExplicit(propId, prop);
}
- } catch (FOPException e) {
- /**@todo log this exception */
- // log.error(e.getMessage());
+ } catch (PropertyException e) {
+ // TODO: Add strict validation.
+ log.error(e.getMessage());
}
}
int propId,
String basePropName,
PropertyMaker propertyMaker)
- throws FOPException {
+ throws PropertyException {
/* If the baseProperty has already been created, return it
* e.g. <fo:leader xxxx="120pt" xxxx.maximum="200pt"... />
* @param propId ID of property
* @return new Property object
*/
- private Property getShorthand(int propId) {
+ private Property getShorthand(int propId) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId);
if (propertyMaker != null) {
* @return new Property object
* @throws FOPException for errors in the input
*/
- private Property makeProperty(int propId) throws FOPException {
+ private Property makeProperty(int propId) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId);
if (propertyMaker != null) {
return propertyMaker.make(this);
* Constructs a BorderAndPadding object.
* @return a BorderAndPadding object
*/
- public CommonBorderPaddingBackground getBorderPaddingBackgroundProps() {
+ public CommonBorderPaddingBackground getBorderPaddingBackgroundProps() throws PropertyException {
return new CommonBorderPaddingBackground(this);
}
* Constructs a HyphenationProps objects.
* @return a HyphenationProps object
*/
- public CommonHyphenation getHyphenationProps() {
+ public CommonHyphenation getHyphenationProps() throws PropertyException {
return new CommonHyphenation(this);
}
* Constructs a MarginProps objects.
* @return a MarginProps object
*/
- public CommonMarginBlock getMarginBlockProps() {
+ public CommonMarginBlock getMarginBlockProps() throws PropertyException {
return new CommonMarginBlock(this);
}
* Constructs a MarginInlineProps objects.
* @return a MarginInlineProps object
*/
- public CommonMarginInline getMarginInlineProps() {
+ public CommonMarginInline getMarginInlineProps() throws PropertyException {
return new CommonMarginInline(this);
}
* Constructs a AccessibilityProps objects.
* @return a AccessibilityProps object
*/
- public CommonAccessibility getAccessibilityProps() {
+ public CommonAccessibility getAccessibilityProps() throws PropertyException {
return new CommonAccessibility(this);
}
* Constructs a AuralProps objects.
* @return a AuralProps object
*/
- public CommonAural getAuralProps() {
+ public CommonAural getAuralProps() throws PropertyException {
CommonAural props = new CommonAural(this);
return props;
}
* Constructs a RelativePositionProps objects.
* @return a RelativePositionProps object
*/
- public CommonRelativePosition getRelativePositionProps() {
+ public CommonRelativePosition getRelativePositionProps() throws PropertyException {
return new CommonRelativePosition(this);
}
* Constructs a AbsolutePositionProps objects.
* @return a AbsolutePositionProps object
*/
- public CommonAbsolutePosition getAbsolutePositionProps() {
+ public CommonAbsolutePosition getAbsolutePositionProps() throws PropertyException {
return new CommonAbsolutePosition(this);
}
* Constructs a CommonFont object.
* @return A CommonFont object
*/
- public CommonFont getFontProps() {
+ public CommonFont getFontProps() throws PropertyException {
return new CommonFont(this);
}
}
*/
package org.apache.fop.fo;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.Property;
/**
* retrieved property values.
* @param propId The property ID
*/
- public Property get(int propId, boolean bTryInherit, boolean bTryDefault) {
+ public Property get(int propId, boolean bTryInherit, boolean bTryDefault)
+ throws PropertyException
+ {
Property p = values[propId];
if (p == null) {
p = values[propId] = super.get(propId, bTryInherit, bTryDefault);
--- /dev/null
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fo;
+
+import org.apache.fop.apps.FOPException;
+import org.xml.sax.Locator;
+
+/**
+ * Exception thrown during FO tree validation.
+ */
+public class ValidationException extends FOPException {
+ public ValidationException(String message) {
+ super(message);
+ }
+
+ public ValidationException(String message, Locator locator) {
+ super(message, locator);
+ }
+}
import java.awt.geom.Point2D;
import java.util.HashMap;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.fop.apps.FOPException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-import javax.xml.parsers.DocumentBuilderFactory;
/**
* Abstract class modelling generic, non-XSL-FO XML objects. Such objects are
* here, blocks XSL FO's from having non-FO parents.
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
invalidChildError(loc, nsURI, localName);
}
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList propertyList) throws SAXParseException {
+ Attributes attlist, PropertyList propertyList) throws FOPException {
setLocator(locator);
name = elementName;
attr = attlist;
if (dim == 1) {
return this;
}
- System.err.print("Can't create length with dimension " + dim);
+ log.error("Can't create length with dimension " + dim);
return null;
}
package org.apache.fop.fo.expr;
+import org.apache.fop.apps.FOPException;
+
/**
* Class for managing exceptions that are raised in Property processing.
*/
-public class PropertyException extends Exception {
+public class PropertyException extends FOPException {
+ private String propertyName;
/**
* Constructor
super(detail);
}
+ /**
+ */
+ public void setPropertyInfo(PropertyInfo propInfo) {
+ setLocator(propInfo.getFO().locator);
+ propertyName = propInfo.getPropertyMaker().getName();
+ }
+
+ /**
+ */
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+ public String getMessage() {
+ if (propertyName != null) {
+ return super.getMessage() + "; property:'" + propertyName + "'";
+ } else {
+ return super.getMessage();
+ }
+ }
}
/**
* @return the current font-size value as base units (milli-points).
*/
- public int currentFontSize() {
+ public int currentFontSize() throws PropertyException {
return plist.get(Constants.PR_FONT_SIZE).getLength().getValue();
}
return plist;
}
+ /**
+ * accessor for PropertyMaker
+ * @return PropertyMaker object
+ */
+ public PropertyMaker getPropertyMaker() {
+ return maker;
+ }
+
/**
* push a function onto the function stack
* @param func function to push onto stack
*/
public static Property parse(String expr, PropertyInfo propInfo)
throws PropertyException {
- return new PropertyParser(expr, propInfo).parseProperty();
+ try {
+ return new PropertyParser(expr, propInfo).parseProperty();
+ } catch (PropertyException exc) {
+ exc.setPropertyInfo(propInfo);
+ throw exc;
+ }
}
return prop;
}
default:
+ // TODO: add the token or the expr to the error message.
throw new PropertyException("syntax error");
}
next();
if (dimension == 1) {
return this;
}
- System.err.print("Can't create length with dimension " + dimension);
+ log.error("Can't create length with dimension " + dimension);
return null;
}
try {
return (int) getNumericValue();
} catch (PropertyException exc) {
- exc.printStackTrace();
+ log.error(exc);
}
return 0;
}
// Java
import java.util.ArrayList;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.pagination.Root;
* the bookmark data from the child elements and add
* the extension to the area tree.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
((Root) parent).setBookmarks(this);
}
package org.apache.fop.fo.extensions;
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
/**
*/
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList)
- throws SAXParseException
+ throws FOPException
{
// Empty
}
* Create a default property list for this element.
*/
protected PropertyList createPropertyList(PropertyList parent,
- FOEventHandler foEventHandler) throws SAXParseException {
+ FOEventHandler foEventHandler) throws FOPException {
return null;
}
}
package org.apache.fop.fo.extensions;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.PropertyList;
-
import java.util.ArrayList;
import org.xml.sax.Attributes;
-import org.xml.sax.SAXParseException;
import org.xml.sax.Locator;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+
/**
* The outline object for the pdf bookmark extension.
* @see org.apache.fop.fo.FObj#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList propertyList) throws SAXParseException
+ Attributes attlist, PropertyList propertyList) throws FOPException
{
internalDestination =
attlist.getValue("internal-destination");
package org.apache.fop.fo.extensions.svg;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.w3c.dom.svg.SVGDocument;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.util.SVGConstants;
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList propertyList) throws SAXParseException {
+ Attributes attlist, PropertyList propertyList) throws FOPException {
super.processNode(elementName, locator, attlist, propertyList);
init();
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.BasicLinkLayoutManager;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
// destinationPlacementOffset = pList.get(PR_DESTINATION_PLACEMENT_OFFSET);
// dominantBaseline = pList.get(PR_DOMINANT_BASELINE);
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
super.startOfNode();
getFOEventHandler().startLink(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
super.endOfNode();
getFOEventHandler().endLink();
}
* XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(#PCDATA|%inline;|%block;)");
import java.util.ArrayList;
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.ColorTypeProperty;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonFont;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAural = pList.getAuralProps();
commonFont = pList.getFontProps();
commonRelativePosition = pList.getRelativePositionProps();
* fo:inline-container."
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker",
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.CharIterator;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.PropertySets;
import org.apache.fop.fo.RecursiveCharIterator;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.SpaceProperty;
import org.apache.fop.layoutmgr.BlockLayoutManager;
-import org.apache.fop.fo.Constants;
import org.apache.fop.util.CharUtilities;
/*
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startBlock(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
handleWhiteSpace();
getFOEventHandler().endBlock(this);
}
* fo:inline-container."
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound || initialPropertySetFound) {
nodesOutOfOrderError(loc, "fo:marker",
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- public void addChildNode(FONode child) throws SAXParseException {
+ public void addChildNode(FONode child) throws FOPException {
// Handle whitespace based on values of properties
// Handle a sequence of inline-producing child nodes in
// one pass
// Java
import java.util.List;
-// FOP
+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.properties.LengthRangeProperty;
import org.apache.fop.layoutmgr.BlockContainerLayoutManager;
-import org.xml.sax.SAXParseException;
-
/**
* Class modelling the fo:block-container object.
* @todo implement validateChildNode()
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAbsolutePosition = pList.getAbsolutePositionProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginBlock = pList.getMarginBlockProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startBlockContainer(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endBlockContainer(this);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.OneCharIterator;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.Property;
-import org.apache.fop.fo.OneCharIterator;
import org.apache.fop.layoutmgr.CharacterLayoutManager;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonFont = pList.getFontProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().character(this);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().image(this);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
* fo:float element.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// float = pList.get(PR_FLOAT);
// clear = pList.get(PR_CLEAR);
}
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(%block;)+");
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnote(this);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
super.endOfNode();
if (inlineFO == null || footnoteBody == null) {
missingChildElementError("(inline,footnote-body)");
* generates an absolutely positioned area.
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("inline")) {
if (inlineFO != null) {
tooManyNodesError(loc, "fo:inline");
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
super(parent);
}
- /**
- * 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 SAXParseException {
- if (childNodes == null) {
- missingChildElementError("(%block;)+");
- }
- getFOEventHandler().endFootnoteBody(this);
- }
-
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startFootnoteBody(this);
}
+ /**
+ * 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 {
+ if (childNodes == null) {
+ missingChildElementError("(%block;)+");
+ }
+ getFOEventHandler().endFootnoteBody(this);
+ }
+
/**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
+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.ColorTypeProperty;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.SpaceProperty;
-import org.apache.fop.fo.FONode;
-import org.apache.fop.fo.FObj;
/**
* Class modelling the fo:initial-property-set object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.InlineCharIterator;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
/* Check to see if this node can have block-level children.
* See validateChildNode() below.
*/
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endInline(this);
}
* nearer ancestor that is an fo:inline-container." (paraphrased)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockOrInlineItemFound) {
nodesOutOfOrderError(loc, "fo:marker",
package org.apache.fop.fo.flow;
// Java
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.layoutmgr.LayoutManager;
-import org.apache.fop.layoutmgr.ICLayoutManager;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
+import org.apache.fop.layoutmgr.ICLayoutManager;
+import org.apache.fop.layoutmgr.LayoutManager;
/**
* Class modelling the fo:inline-container object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginInline = pList.getMarginInlineProps();
commonRelativePosition = pList.getRelativePositionProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.FObj;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#start
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes.size() != 1) {
missingChildElementError("one (1) non-XSL namespace child");
}
* XSL Content Model: one (1) non-XSL namespace child
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
invalidChildError(loc, nsURI, localName);
} else if (childNodes != null) {
// Java
import java.util.List;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startList(this);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasListItem) {
missingChildElementError("marker* (list-item)+");
}
* XSL Content Model: marker* (list-item)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (hasListItem) {
nodesOutOfOrderError(loc, "fo:marker", "fo:list-item");
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListItem(this);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (label == null || body == null) {
missingChildElementError("marker* (list-item-label,list-item-body)");
}
* XSL Content Model: marker* (list-item-label,list-item-body)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (label != null) {
nodesOutOfOrderError(loc, "fo:marker", "fo:list-item-label");
package org.apache.fop.fo.flow;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListBody();
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endListBody();
}
package org.apache.fop.fo.flow;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
keepTogether = pList.get(PR_KEEP_TOGETHER).getKeep();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startListLabel();
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endListLabel();
}
import java.util.HashMap;
import java.util.Iterator;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
-import org.apache.fop.fo.FOEventHandler;
-import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.PropertyListMaker;
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.Property;
/**
* Marker formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
markerClassName = pList.get(PR_MARKER_CLASS_NAME).getString();
}
* parentPropertyList which comes from the fo:retrieve-marker element.
* @param parentPropertyList The property list from fo:retrieve-marker.
*/
- public void rebind(PropertyList parentPropertyList) throws SAXParseException {
+ public void rebind(PropertyList parentPropertyList) throws FOPException {
// Set a new parent property list and bind all the children again.
propertyList.setParentPropertyList(parentPropertyList);
for (Iterator i = children.keySet().iterator(); i.hasNext(); ) {
}
}
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws SAXParseException {
+ protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
propertyList = new MarkerPropertyList(this, parent);
return propertyList;
}
});
}
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (!children.containsKey(child)) {
children.put(child, propertyList);
}
* @todo implement "additional" constraint, possibly within fo:retrieve-marker
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockOrInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
package org.apache.fop.fo.flow;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
// startingState = pList.get(PR_STARTING_STATE);
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
id = pList.get(PR_ID).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasMultiPropertySet || !hasWrapper) {
missingChildElementError("(multi-property-set+, wrapper)");
}
* XSL Content Model: (multi-property-set+, wrapper)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("multi-property-set")) {
if (hasWrapper) {
nodesOutOfOrderError(loc, "fo:multi-property-set", "fo:wrapper");
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
* Class modelling the fo:multi-property-set object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
id = pList.get(PR_ID).getString();
// activeState = pList.get(PR_ACTIVE_STATE);
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
// autoRestore = pList.get(PR_AUTO_RESTORE);
id = pList.get(PR_ID).getString();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* Make sure content model satisfied.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(multi-case+)");
}
* XSL Content Model: (multi-case+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI && localName.equals("multi-case"))) {
invalidChildError(loc, nsURI, localName);
}
package org.apache.fop.fo.flow;
// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
// prSwitchTo = pList.get(PR_SWITCH_TO);
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startPageNumber(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endPageNumber(this);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
if (refId.equals("")) {
missingPropertyError("ref-id");
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
-import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.StaticPropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.layoutmgr.RetrieveMarkerLayoutManager;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
retrieveClassName = pList.get(PR_RETRIEVE_CLASS_NAME).getString();
retrievePosition = pList.get(PR_RETRIEVE_POSITION).getEnum();
retrieveBoundary = pList.get(PR_RETRIEVE_BOUNDARY).getEnum();
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
protected PropertyList createPropertyList(PropertyList parent,
- FOEventHandler foEventHandler) throws SAXParseException {
+ FOEventHandler foEventHandler) throws FOPException {
// TODO: A special RetrieveMarkerPropertyList would be more memory
// efficient. Storing a StaticPropertyList like this will keep all
// the parent PropertyLists alive.
package org.apache.fop.fo.flow;
// Java
+import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
-import java.util.ArrayList;
-
-// XML
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.LengthPairProperty;
import org.apache.fop.fo.properties.LengthRangeProperty;
-import org.apache.fop.layoutmgr.table.TableLayoutManager;
import org.apache.fop.layoutmgr.table.Body;
import org.apache.fop.layoutmgr.table.Column;
+import org.apache.fop.layoutmgr.table.TableLayoutManager;
/**
* Class modelling the fo:table object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startTable(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endTable(this);
}
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) throws SAXParseException {
+ protected void addChildNode(FONode child) throws FOPException {
if (child.getName().equals("fo:table-column")) {
if (columns == null) {
columns = new ArrayList();
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!tableFound) {
missingChildElementError("marker* table-caption? table");
}
* XSL Content Model: marker* table-caption? table
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (tableCaptionFound) {
// Java
import java.util.List;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startBody(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endBody(this);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("marker* (%block;)");
}
* XSL Content Model: marker* (%block;)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startCell(this);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
}
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
// borderAfterPrecedence = pList.get(PR_BORDER_AFTER_PRECEDENCE);
// borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE);
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
getFOEventHandler().startColumn(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
getFOEventHandler().endColumn(this);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
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.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
commonAural = pList.getAuralProps();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
getFOEventHandler().startRow(this);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(table-cell+)");
}
* XSL Content Model: (table-cell+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI && localName.equals("table-cell"))) {
invalidChildError(loc, nsURI, localName);
}
import java.util.List;
import java.util.ListIterator;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
id = pList.get(PR_ID).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
checkId(id);
}
package org.apache.fop.fo.pagination;
// Java
-import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
-import java.net.URL;
+import java.awt.color.ICC_Profile;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
/**
* The fo:color-profile formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
src = pList.get(PR_SRC).getString();
colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString();
renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum();
XSL 1.0/FOP: EMPTY (no child nodes permitted)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
* A conditional-page-master-reference formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
pagePosition = pList.get(PR_PAGE_POSITION).getEnum();
oddOrEven = pList.get(PR_ODD_OR_EVEN).getEnum();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
validateParent(parent);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
* Check that the parent is the right type of formatting object
* repeatable-page-master-alternatives.
* @param parent parent node
- * @throws SAXParseException If the parent is invalid
+ * @throws ValidationException If the parent is invalid
*/
- protected void validateParent(FONode parent) throws SAXParseException {
+ protected void validateParent(FONode parent) throws ValidationException {
if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
this.repeatablePageMasterAlternatives =
(RepeatablePageMasterAlternatives)parent;
this.repeatablePageMasterAlternatives.addConditionalPageMasterReference(this);
}
} else {
- throw new SAXParseException("fo:conditional-page-master-reference must be child "
+ throw new ValidationException("fo:conditional-page-master-reference must be child "
+ "of fo:repeatable-page-master-alternatives, not "
+ parent.getName(), locator);
}
package org.apache.fop.fo.pagination;
// Java
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Iterator;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.XMLObj;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// No properties defined for fo:declarations
}
FOP/XSL 1.1: (color-profile)* (and non-XSL NS nodes)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("color-profile")) {
invalidChildError(loc, nsURI, localName);
* At the end of this element sort out the child into
* a hashmap of color profiles and a list of external xml.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes != null) {
for (Iterator iter = childNodes.iterator(); iter.hasNext();) {
FONode node = (FONode)iter.next();
import java.util.ArrayList;
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.layoutmgr.FlowLayoutManager;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
flowName = pList.get(PR_FLOW_NAME).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (!parent.getName().equals("fo:page-sequence")) {
- throw new SAXParseException("flow must be child of "
+ throw new ValidationException("flow must be child of "
+ "page-sequence, not " + parent.getName(), locator);
}
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!blockItemFound) {
missingChildElementError("marker* (%block;)+");
}
* XSL Content Model: marker* (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("marker")) {
if (blockItemFound) {
nodesOutOfOrderError(loc, "fo:marker", "(%block;)");
import java.util.Iterator;
import java.util.Map;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
* The layout-master-set formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
// No properties in layout-master-set.
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (parent.getName().equals("fo:root")) {
Root root = (Root)parent;
root.setLayoutMasterSet(this);
} else {
- throw new SAXParseException("fo:layout-master-set must be child of fo:root, not "
+ throw new ValidationException("fo:layout-master-set must be child of fo:root, not "
+ parent.getName(), locator);
}
simplePageMasters = new java.util.HashMap();
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(simple-page-master|page-sequence-master)+");
}
XSL/FOP: (simple-page-master|page-sequence-master)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("simple-page-master")
&& !localName.equals("page-sequence-master")) {
/**
* Section 7.25.7: check to see that if a region-name is a
* duplicate, that it maps to the same fo region-class.
- * @throws SAXParseException if there's a name duplication
+ * @throws ValidationException if there's a name duplication
*/
- private void checkRegionNames() throws SAXParseException {
+ private void checkRegionNames() throws ValidationException {
// (user-entered) region-name to default region map.
Map allRegions = new java.util.HashMap();
for (Iterator spm = simplePageMasters.values().iterator();
String defaultRegionName =
(String) allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
- throw new SAXParseException("Region-name ("
+ throw new ValidationException("Region-name ("
+ region.getRegionName()
+ ") is being mapped to multiple "
+ "region-classes ("
* Add a simple page master.
* The name is checked to throw an error if already added.
* @param sPM simple-page-master to add
- * @throws SAXParseException if there's a problem with name uniqueness
+ * @throws ValidationException if there's a problem with name uniqueness
*/
protected void addSimplePageMaster(SimplePageMaster sPM)
- throws SAXParseException {
+ throws ValidationException {
// check for duplication of master-name
String masterName = sPM.getMasterName();
if (existsName(masterName)) {
- throw new SAXParseException("'master-name' ("
+ throw new ValidationException("'master-name' ("
+ masterName
+ ") must be unique "
+ "across page-masters and page-sequence-masters", sPM.locator);
* The name is checked to throw an error if already added.
* @param masterName name for the master
* @param pSM PageSequenceMaster instance
- * @throws SAXParseException if there's a problem with name uniqueness
+ * @throws ValidationException if there's a problem with name uniqueness
*/
protected void addPageSequenceMaster(String masterName,
PageSequenceMaster pSM)
- throws SAXParseException {
+ throws ValidationException {
// check against duplication of master-name
if (existsName(masterName)) {
- throw new SAXParseException("'master-name' ("
+ throw new ValidationException("'master-name' ("
+ masterName
+ ") must be unique "
+ "across page-masters and page-sequence-masters", pSM.locator);
// Java
import java.util.HashMap;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.Property;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
country = pList.get(PR_COUNTRY).getString();
format = pList.get(PR_FORMAT).getString();
language = pList.get(PR_LANGUAGE).getString();
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
this.root = (Root) parent;
layoutMasterSet = root.getLayoutMasterSet();
flowMap = new HashMap();
this.pageSequenceMaster =
this.layoutMasterSet.getPageSequenceMaster(masterReference);
if (this.pageSequenceMaster == null) {
- throw new SAXParseException("master-reference '" + masterReference
+ throw new ValidationException("master-reference '" + masterReference
+ "' for fo:page-sequence matches no"
+ " simple-page-master or page-sequence-master", locator);
}
* This passes the end page sequence to the structure handler
* so it can act upon that.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (mainFlow == null) {
missingChildElementError("(title?,static-content*,flow)");
}
XSL Content Model: (title?,static-content*,flow)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("title")) {
if (titleFO != null) {
* @todo see if addChildNode() should also be called for fo's other than
* fo:flow.
*/
- public void addChildNode(FONode child) throws SAXParseException {
+ public void addChildNode(FONode child) throws FOPException {
int childId = child.getNameId();
if (childId == FO_TITLE) {
* based on the region-names given to the regions in the page-master
* used to generate that page.
*/
- private void addFlow(Flow flow) throws SAXParseException {
+ private void addFlow(Flow flow) throws ValidationException {
String flowName = flow.getFlowName();
if (hasFlowName(flowName)) {
- throw new SAXParseException ("duplicate flow-name \""
+ throw new ValidationException("duplicate flow-name \""
+ flowName
+ "\" found within fo:page-sequence", flow.locator);
}
if (!layoutMasterSet.regionNameExists(flowName)
&& !flowName.equals("xsl-before-float-separator")
&& !flowName.equals("xsl-footnote-separator")) {
- throw new SAXParseException ("flow-name \""
+ throw new ValidationException("flow-name \""
+ flowName
+ "\" could not be mapped to a region-name in the"
+ " layout-master-set", flow.locator);
// Java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
-import org.apache.fop.fo.FObj;
+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.apps.FOPException;
+import org.apache.fop.fo.ValidationException;
/**
* The page-sequence-master formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterName = pList.get(PR_MASTER_NAME).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
subSequenceSpecifiers = new java.util.ArrayList();
if (parent.getName().equals("fo:layout-master-set")) {
this.layoutMasterSet = (LayoutMasterSet)parent;
this.layoutMasterSet.addPageSequenceMaster(masterName, this);
}
} else {
- throw new SAXParseException("fo:page-sequence-master must be child "
+ throw new ValidationException("fo:page-sequence-master must be child "
+ "of fo:layout-master-set, not "
+ parent.getName(), locator);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode()
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(single-page-master-reference|" +
"repeatable-page-master-reference|repeatable-page-master-alternatives)+");
* repeatable-page-master-alternatives)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (!localName.equals("single-page-master-reference")
&& !localName.equals("repeatable-page-master-reference")
import java.awt.Rectangle;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.FODimension;
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;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
// clip = pList.get(PR_CLIP);
displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
- throw new SAXParseException("region-name '" + regionName
+ throw new ValidationException("region-name '" + regionName
+ "' for " + this.getName()
+ " is not permitted.", locator);
}
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
extent = pList.get(PR_EXTENT).getLength();
precedence = pList.get(PR_PRECEDENCE).getEnum();
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
commonMarginBlock = pList.getMarginBlockProps();
columnCount = pList.get(PR_COLUMN_COUNT).getNumeric();
// Java
import java.awt.Rectangle;
-// XML
-import org.xml.sax.SAXParseException;
-
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) throws SAXParseException {
+ public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
extent = pList.get(PR_EXTENT).getLength();
}
// Java
import java.util.ArrayList;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.Property;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
conditionalPageMasterRefs = new ArrayList();
if (parent.getName().equals("fo:page-sequence-master")) {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
} else {
- throw new SAXParseException("fo:repeatable-page-master-alternatives "
+ throw new ValidationException("fo:repeatable-page-master-alternatives "
+ "must be child of fo:page-sequence-master, not "
+ parent.getName(), locator);
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(conditional-page-master-reference+)");
}
XSL/FOP: (conditional-page-master-reference+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!(nsURI == FO_URI &&
localName.equals("conditional-page-master-reference"))) {
invalidChildError(loc, nsURI, localName);
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.Property;
/**
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
maximumRepeats = pList.get(PR_MAXIMUM_REPEATS);
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
if (masterReference == null) {
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// java
import java.util.List;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.FOEventHandler;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
/**
* The fo:root formatting object. Contains page masters, page-sequences.
/**
* Signal end of this xml element.
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!pageSequenceFound || layoutMasterSet == null) {
missingChildElementError("(layout-master-set, declarations?, " +
"fox:bookmarks?, page-sequence+)");
FOP: (layout-master-set, declarations?, fox:bookmarks?, page-sequence+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI) {
if (localName.equals("layout-master-set")) {
if (layoutMasterSet != null) {
import java.util.Iterator;
import java.util.Map;
-// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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.CommonMarginBlock;
/**
/**
* @see org.apache.fop.fo.FObj#resolve
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonMarginBlock = pList.getMarginBlockProps();
masterName = pList.get(PR_MASTER_NAME).getString();
pageHeight = pList.get(PR_PAGE_HEIGHT).getLength();
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
LayoutMasterSet layoutMasterSet = (LayoutMasterSet) parent;
if (masterName == null) {
* Make sure content model satisfied.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (!hasRegionBody) {
missingChildElementError("(region-body, region-before?," +
" region-after?, region-start?, region-end?)");
* XSL Content Model: (region-body,region-before?,region-after?,region-start?,region-end?)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (nsURI == FO_URI && localName.equals("region-body")) {
if (hasRegionBody) {
tooManyNodesError(loc, "fo:region-body");
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+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;
/**
* A single-page-master-reference formatting object.
/**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
}
/**
* @see org.apache.fop.fo.FONode#startOfNode
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster) parent;
if (masterReference == null) {
missingPropertyError("master-reference");
* XSL Content Model: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.ValidationException;
/**
* Class modelling the fo:static-content object.
/**
* @see org.apache.fop.fo.FONode#startOfNode()
*/
- protected void startOfNode() throws SAXParseException {
+ protected void startOfNode() throws FOPException {
if (getFlowName() == null || getFlowName().equals("")) {
- throw new SAXParseException("A 'flow-name' is required for "
+ throw new ValidationException("A 'flow-name' is required for "
+ getName() + ".", locator);
}
getFOEventHandler().startFlow(this);
* FOEventHandler that we are at the end of the flow.
* @see org.apache.fop.fo.FONode#endOfNode
*/
- protected void endOfNode() throws SAXParseException {
+ protected void endOfNode() throws FOPException {
if (childNodes == null) {
missingChildElementError("(%block;)+");
}
* XSL Content Model: (%block;)+
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isBlockItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
// XML
import org.xml.sax.Locator;
-import org.xml.sax.SAXParseException;
-// FOP
+import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
-import org.apache.fop.fo.FObjMixed;
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.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
super(parent);
}
- public void bind(PropertyList pList) {
+ public void bind(PropertyList pList) throws FOPException {
commonAccessibility = pList.getAccessibilityProps();
commonAural = pList.getAuralProps();
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
XSL/FOP: (#PCDATA|%inline;)*
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
+ throws ValidationException {
if (!isInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
}
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* This subclass of LengthProperty.Maker handles the special treatment of
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = super.get(subpropId, propertyList,
bTryInherit, bTryDefault);
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Shorthand property parser for Box properties
protected Property convertValueForProperty(int propId,
ListProperty listProperty,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
String name = FOPropertyMapping.getPropertyName(propId);
Property p = null;
int count = listProperty.getList().size();
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common absolute position properties.
* Create a CommonAbsolutePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonAbsolutePosition(PropertyList pList) {
+ public CommonAbsolutePosition(PropertyList pList) throws PropertyException {
absolutePosition = pList.get(Constants.PR_ABSOLUTE_POSITION).getEnum();
top = pList.get(Constants.PR_TOP).getLength();
bottom = pList.get(Constants.PR_BOTTOM).getLength();
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common accessibility properties.
* Create a CommonAbsolutePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonAccessibility(PropertyList pList) {
+ public CommonAccessibility(PropertyList pList) throws PropertyException {
sourceDoc = pList.get(Constants.PR_SOURCE_DOCUMENT).getString();
if ("none".equals(sourceDoc)) {
sourceDoc = null;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Stores all common border and padding properties.
* Construct a CommonBorderPaddingBackground object.
* @param pList The PropertyList to get properties from.
*/
- public CommonBorderPaddingBackground(PropertyList pList) {
+ public CommonBorderPaddingBackground(PropertyList pList) throws PropertyException {
backgroundAttachment = pList.get(Constants.PR_BACKGROUND_ATTACHMENT).getEnum();
backgroundColor = pList.get(Constants.PR_BACKGROUND_COLOR).getColorType();
if (backgroundColor.getAlpha() == 0) {
}
private void initBorderInfo(PropertyList pList, int side,
- int colorProp, int styleProp, int widthProp, int paddingProp)
+ int colorProp, int styleProp, int widthProp, int paddingProp)
+ throws PropertyException
{
padding[side] = pList.get(paddingProp).getCondLength();
// If style = none, force width to 0, don't get Color (spec 7.7.20)
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontMetrics;
* Create a CommonFont object.
* @param pList The PropertyList to get properties from.
*/
- public CommonFont(PropertyList pList) {
+ public CommonFont(PropertyList pList) throws PropertyException {
fontFamily = pList.get(Constants.PR_FONT_FAMILY).getString();
fontSelectionStrategy = pList.get(Constants.PR_FONT_SELECTION_STRATEGY).getEnum();
fontSize = pList.get(Constants.PR_FONT_SIZE).getLength();
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common hyphenation properties.
* Create a CommonHyphenation object.
* @param pList The PropertyList with propery values.
*/
- public CommonHyphenation(PropertyList pList) {
+ public CommonHyphenation(PropertyList pList) throws PropertyException {
language = pList.get(Constants.PR_LANGUAGE).getString();
country = pList.get(Constants.PR_COUNTRY).getString();
hyphenate = pList.get(Constants.PR_HYPHENATE).getEnum();
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common margin properties for blocks.
* Create a CommonMarginBlock object.
* @param pList The PropertyList with propery values.
*/
- public CommonMarginBlock(PropertyList pList) {
+ public CommonMarginBlock(PropertyList pList) throws PropertyException {
marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common margin properties for inlines.
* Create a CommonMarginInline object.
* @param pList The PropertyList with propery values.
*/
- public CommonMarginInline(PropertyList pList) {
+ public CommonMarginInline(PropertyList pList) throws PropertyException {
marginTop = pList.get(Constants.PR_MARGIN_TOP).getLength();
marginBottom = pList.get(Constants.PR_MARGIN_BOTTOM).getLength();
marginLeft = pList.get(Constants.PR_MARGIN_LEFT).getLength();
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Store all common relative position properties.
* Create a CommonRelativePosition object.
* @param pList The PropertyList with propery values.
*/
- public CommonRelativePosition(PropertyList pList) {
+ public CommonRelativePosition(PropertyList pList) throws PropertyException {
relativePosition = pList.get(Constants.PR_RELATIVE_POSITION).getEnum();
top = pList.get(Constants.PR_TOP).getLength();
bottom = pList.get(Constants.PR_BOTTOM).getLength();
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* @author me
*/
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
if (subpropId != 0 && p != null) {
* @param fo The parent FO for the FO whose property is being made.
* @return A Property of the correct type or null if the parsed value
* can't be converted to the correct type.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (!EnumProperty.class.isAssignableFrom(p.getClass())) {
// delegate to the subprop maker to do conversions
p = shorthandMaker.convertProperty(p, propertyList, fo);
* Make a compound property with default values.
* @param propertyList The PropertyList object being built for this FO.
* @return the Property object corresponding to the parameters
- * @throws FOPException for invalid or inconsisten FO input
+ * @throws PropertyException for invalid or inconsisten FO input
*/
- public Property make(PropertyList propertyList) throws FOPException {
+ public Property make(PropertyList propertyList) throws PropertyException {
if (defaultValue != null) {
return make(propertyList, defaultValue, propertyList.getParentFObj());
} else {
* @param value The attribute value.
* @param fo The parent FO for the FO whose property is being made.
* @return The initialized Property object.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property p = super.make(propertyList, value, fo);
p = convertProperty(p, propertyList, fo);
return p;
* @param value the value of the
* @return baseProp (or if null, a new compound property object) with
* the new subproperty added
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(Property baseProp, int subpropId,
PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (baseProp == null) {
baseProp = makeCompound(propertyList, fo);
}
* @param parentFO The parent FO for the FO whose property is being made.
* @return a Property subclass object holding a "compound" property object
* initialized to the default values for each component.
- * @throws FOPException
+ * @throws PropertyException
*/
protected Property makeCompound(PropertyList propertyList, FObj parentFO)
- throws FOPException
+ throws PropertyException
{
Property p = makeNewProperty();
CompoundDatatype data = (CompoundDatatype) p.getObject();
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that have conditional lengths
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof KeepProperty) {
return p;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
*/
* are specified (in foproperties.xml) to compute the value.
* @throws FOPException for invalid or inconsistent FO input
*/
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
PropertyList pList = getWMPropertyList(propertyList);
if (pList == null) {
return null;
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* @author me
return false;
}
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
// Based on [width|height]
Property p = super.compute(propertyList);
if (p == null) {
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that wrap an enumeration value
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p instanceof EnumProperty) {
return p;
} else {
package org.apache.fop.fo.properties;
import java.util.Enumeration;
+
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
public class GenericShorthandParser implements ShorthandParser {
public Property getValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
Property prop = null;
// Check for keyword "inherit"
if (property.getList().size() == 1) {
protected Property convertValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList) {
+ PropertyList propertyList)
+ throws PropertyException
+ {
Property prop = null;
// Try each of the stored values in turn
Enumeration eprop = property.getList().elements();
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Numeric;
-import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.NumericOp;
+import org.apache.fop.fo.expr.PropertyException;
/**
* This property maker handles the calculations described in 5.3.2 which
* Calculate the corresponding value for start-indent and end-indent.
* @see CorrespondingPropertyMaker#compute(PropertyList)
*/
- public Property compute(PropertyList propertyList) throws FOPException {
+ public Property compute(PropertyList propertyList) throws PropertyException {
PropertyList pList = getWMPropertyList(propertyList);
// Calculate the values as described in 5.3.2.
- try {
- int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
- Numeric margin;
+
+ int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+ Numeric margin;
// Calculate the absolute margin.
- if (propertyList.getExplicitOrShorthand(marginProp) == null) {
- Property indent = propertyList.getExplicit(baseMaker.propId);
- if (indent == null) {
- margin = new FixedLength(0);
- } else {
- margin = propertyList.getExplicit(baseMaker.propId).getNumeric();
- margin = NumericOp.subtraction(margin, propertyList.getInherited(baseMaker.propId).getNumeric());
- }
- margin = NumericOp.subtraction(margin, getCorresponding(paddingCorresponding, propertyList).getNumeric());
- margin = NumericOp.subtraction(margin, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ if (propertyList.getExplicitOrShorthand(marginProp) == null) {
+ Property indent = propertyList.getExplicit(baseMaker.propId);
+ if (indent == null) {
+ margin = new FixedLength(0);
} else {
- margin = propertyList.get(marginProp).getNumeric();
- }
-
- Numeric v = new FixedLength(0);
- if (!propertyList.getFObj().generatesReferenceAreas()) {
- // The inherited_value_of([start|end]-indent)
- v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
+ margin = propertyList.getExplicit(baseMaker.propId).getNumeric();
+ margin = NumericOp.subtraction(margin, propertyList.getInherited(baseMaker.propId).getNumeric());
}
- // The corresponding absolute margin-[right|left}.
- v = NumericOp.addition(v, margin);
- v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
- v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
- return (Property) v;
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- String propName = FOPropertyMapping.getPropertyName(baseMaker.getPropId());
- throw new FOPException("Error in " + propName
- + " calculation " + propEx);
- }
+ margin = NumericOp.subtraction(margin, getCorresponding(paddingCorresponding, propertyList).getNumeric());
+ margin = NumericOp.subtraction(margin, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ } else {
+ margin = propertyList.get(marginProp).getNumeric();
+ }
+
+ Numeric v = new FixedLength(0);
+ if (!propertyList.getFObj().generatesReferenceAreas()) {
+ // The inherited_value_of([start|end]-indent)
+ v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
+ }
+ // The corresponding absolute margin-[right|left}.
+ v = NumericOp.addition(v, margin);
+ v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
+ v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+ return (Property) v;
}
- private Property getCorresponding(int[] corresponding, PropertyList propertyList) {
+ private Property getCorresponding(int[] corresponding, PropertyList propertyList)
+ throws PropertyException
+ {
PropertyList pList = getWMPropertyList(propertyList);
int wmcorr = pList.getWritingMode(corresponding[0], corresponding[1], corresponding[2]);
return propertyList.get(wmcorr);
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that wrap Keep values
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof KeepProperty) {
return p;
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties wrapping a LengthPair value
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof LengthPairProperty) {
return p;
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties wrapping a Length value.
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property prop = super.convertProperty(p, propertyList, fo);
if (prop != null) {
return prop;
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Superclass for properties that contain LengthRange values
* @see CompoundPropertyMaker#convertProperty
*/
public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws FOPException
+ throws PropertyException
{
if (p instanceof LengthRangeProperty) {
return p;
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
* @see PropertyMaker#make(PropertyList, String, FObj)
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Property p = super.make(propertyList, value, fo);
p.setSpecifiedValue(checkValueKeywords(value));
return p;
* value.
* @see PropertyMaker#compute(PropertyList)
*/
- protected Property compute(PropertyList propertyList) throws FOPException {
+ protected Property compute(PropertyList propertyList) throws PropertyException {
// recalculate based on last specified value
// Climb up propertylist and find last spec'd value
Property specProp = propertyList.getNearestSpecified(propId);
if (specProp != null) {
String specVal = specProp.getSpecifiedValue();
if (specVal != null) {
- try {
- return make(propertyList, specVal,
+ return make(propertyList, specVal,
propertyList.getParentFObj());
- } catch (FOPException e) {
- //getLogger()error("Error computing property value for "
- // + propName + " from "
- // + specVal);
- return null;
- }
}
}
return null;
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
Numeric numval = p.getNumeric();
if (numval != null && numval.getDimension() == 0) {
- try {
- p = new PercentLength(numval.getNumericValue(), getPercentBase(fo,propertyList));
- } catch (PropertyException exc) {
- // log.error("exception", exc);
- }
+ p = new PercentLength(numval.getNumericValue(), getPercentBase(fo,propertyList));
}
return super.convertProperty(p, propertyList, fo);
}
package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.fo.expr.PropertyException;
/**
* a percent specified length quantity in XSL
*/
public class PercentLength extends LengthProperty {
-
+
/**
* The percentage itself, expressed as a decimal value, e.g. for 95%, set
* the value to .95
* @see org.apache.fop.datatypes.Numeric#getNumericValue()
*/
public double getNumericValue() {
- return factor * lbase.getBaseLength();
+ try {
+ return factor * lbase.getBaseLength();
+ } catch (PropertyException exc) {
+ log.error(exc);
+ return 0;
+ }
}
/**
* @see org.apache.fop.datatypes.Length#getValue()
*/
public int getValue() {
- return (int) (factor * lbase.getBaseLength());
+ return (int) getNumericValue();
}
/**
import java.util.Vector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
* @author unascribed
*/
public class Property {
+ protected static Log log = LogFactory.getLog(PropertyMaker.class);
/**
* The original specified value for properties which inherit
import java.util.HashMap;
import java.util.Map;
-import org.apache.fop.apps.FOPException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.expr.PropertyInfo;
import org.apache.fop.fo.expr.PropertyParser;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Base class for all property makers
protected Property defaultProperty;
protected CorrespondingPropertyMaker corresponding;
- private Log log = LogFactory.getLog(PropertyMaker.class);
+ private static Log log = LogFactory.getLog(PropertyMaker.class);
/**
* @return the name of the property for this Maker
*/
public Property findProperty(PropertyList propertyList,
boolean bTryInherit)
- throws FOPException
+ throws PropertyException
{
Property p = null;
*/
public Property get(int subpropId, PropertyList propertyList,
boolean bTryInherit, boolean bTryDefault)
- throws FOPException
+ throws PropertyException
{
Property p = findProperty(propertyList, bTryInherit);
if (p == null && bTryDefault) { // default value for this FO!
- try {
- p = make(propertyList);
- } catch (FOPException e) {
- // don't know what to do here
- }
+ p = make(propertyList);
}
return p;
}
* Return the default value.
* @param propertyList The PropertyList object being built for this FO.
* @return the Property object corresponding to the parameters
- * @throws FOPException for invalid or inconsisten FO input
+ * @throws PropertyException for invalid or inconsisten FO input
*/
- public Property make(PropertyList propertyList) throws FOPException {
+ public Property make(PropertyList propertyList) throws PropertyException {
if (defaultProperty != null) {
if (log.isTraceEnabled()) {
log.trace("PropertyMaker.make: reusing defaultProperty, "
* @param value The attribute value.
* @param fo The parent FO for the FO whose property is being made.
* @return The initialized Property object.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
try {
Property newProp = null;
String pvalue = value;
newProp = convertProperty(p, propertyList, fo);
}
if (newProp == null) {
- throw new org.apache.fop.fo.expr.PropertyException("No conversion defined");
+ throw new org.apache.fop.fo.expr.PropertyException("No conversion defined " + pvalue);
}
return newProp;
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- String propName = FOPropertyMapping.getPropertyName(this.propId);
- throw new FOPException("Error in " + propName
- + " property value '" + value + "': "
- + propEx);
+ } catch (PropertyException propEx) {
+ propEx.setLocator(fo.locator);
+ propEx.setPropertyName(getName());
+ throw propEx;
}
}
* @param value the value of the
* @return baseProp (or if null, a new compound property object) with
* the new subproperty added
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
public Property make(Property baseProp, int subpropId,
PropertyList propertyList, String value,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
//getLogger().error("compound property component "
// + partName + " unknown.");
return baseProp;
}
public Property convertShorthandProperty(PropertyList propertyList,
- Property prop, FObj fo) {
- Property pret = null;
- try {
- pret = convertProperty(prop, propertyList, fo);
- if (pret == null) {
- // If value is a name token, may be keyword or Enum
- String sval = prop.getNCname();
- if (sval != null) {
- // System.err.println("Convert shorthand ncname " + sval);
- pret = checkEnumValues(sval);
- if (pret == null) {
- /* Check for keyword shorthand values to be substituted. */
- String pvalue = checkValueKeywords(sval);
- if (!pvalue.equals(sval)) {
- // System.err.println("Convert shorthand keyword" + pvalue);
- // Substituted a value: must parse it
- Property p =
- PropertyParser.parse(pvalue,
- new PropertyInfo(this,
- propertyList,
- fo));
- pret = convertProperty(p, propertyList, fo);
- }
+ Property prop, FObj fo)
+ throws PropertyException
+ {
+ Property pret = convertProperty(prop, propertyList, fo);
+ if (pret == null) {
+ // If value is a name token, may be keyword or Enum
+ String sval = prop.getNCname();
+ if (sval != null) {
+ // System.err.println("Convert shorthand ncname " + sval);
+ pret = checkEnumValues(sval);
+ if (pret == null) {
+ /* Check for keyword shorthand values to be substituted. */
+ String pvalue = checkValueKeywords(sval);
+ if (!pvalue.equals(sval)) {
+ // System.err.println("Convert shorthand keyword" + pvalue);
+ // Substituted a value: must parse it
+ Property p =
+ PropertyParser.parse(pvalue,
+ new PropertyInfo(this,
+ propertyList,
+ fo));
+ pret = convertProperty(p, propertyList, fo);
}
}
}
- } catch (FOPException e) {
-
- //getLogger().error("convertShorthandProperty caught FOPException "
- // + e);
- } catch (org.apache.fop.fo.expr.PropertyException propEx) {
- //getLogger().error("convertShorthandProperty caught PropertyException "
- // + propEx);
}
if (pret != null) {
/*
* @param fo The parent FO for the FO whose property is being made.
* @return A Property of the correct type or null if the parsed value
* can't be converted to the correct type.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
return null;
}
* @param propertyList The PropertyList for the FO.
* @return Property A computed Property value or null if no rules
* are specified to compute the value.
- * @throws FOPException for invalid or inconsistent FO input
+ * @throws PropertyException for invalid or inconsistent FO input
*/
protected Property compute(PropertyList propertyList)
- throws FOPException {
+ throws PropertyException {
if (corresponding != null) {
return corresponding.compute(propertyList);
}
* @param propertyList the collection of properties to be considered
* @return the Property, if found, the correspons, otherwise, null
*/
- public Property getShorthand(PropertyList propertyList) {
+ public Property getShorthand(PropertyList propertyList)
+ throws PropertyException
+ {
if (shorthands == null) {
return null;
}
}
return null;
}
+
+ public String getName() {
+ return FOPropertyMapping.getPropertyName(propId);
+ }
/**
* Return a clone of the makers. Used by useGeneric() to clone the
package org.apache.fop.fo.properties;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Interface used to provide parsing capabilities to Properties with shorthand
Property getValueForProperty(int propId,
Property property,
PropertyMaker maker,
- PropertyList propertyList);
+ PropertyList propertyList) throws PropertyException;
}
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* Base class used for handling properties of the fo:space-before and
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p instanceof SpaceProperty) {
return p;
}
package org.apache.fop.fo.properties;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.expr.PropertyException;
/**
* A maker which creates 'letter-spacing' and 'word-spacing' properties.
*/
public Property convertProperty(Property p,
PropertyList propertyList,
- FObj fo) throws FOPException {
+ FObj fo) throws PropertyException {
if (p.getEnum() == Constants.NORMAL) {
return p;
}
package org.apache.fop.layoutmgr;
import java.util.ArrayList;
-import java.util.List;
import java.util.LinkedList;
+import java.util.List;
-import org.xml.sax.SAXParseException;
-
+import org.apache.fop.apps.FOPException;
import org.apache.fop.area.Area;
import org.apache.fop.fo.flow.Marker;
import org.apache.fop.fo.flow.RetrieveMarker;
if (marker != null) {
try {
marker.rebind(fobj.getPropertyList());
- } catch (SAXParseException exc) {
+ } catch (FOPException exc) {
log.error("fo:retrieve-marker unable to rebind property values", exc);
}
marker.addLayoutManager(list);