import org.xml.sax.SAXParseException;
// FOP
-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;
/** Parent FO node */
protected FONode parent;
- /** Marks input file containing this object **/
- public String systemId;
-
- /** Marks line number of this object in the input file **/
- public int line;
-
- /** Marks column number of this object in the input file **/
- public int column;
+ /** Marks location of this object from the input FO
+ * Call locator.getSystemId(), getLineNumber(),
+ * getColumnNumber() for file, line, column
+ * information
+ */
+ public Locator locator;
/** Logger for fo-tree related messages **/
private static Log log = LogFactory.getLog(FONode.class);
*/
public void setLocation(Locator locator) {
if (locator != null) {
- line = locator.getLineNumber();
- column = locator.getColumnNumber();
- systemId = locator.getSystemId();
+ this.locator = locator;
}
}
* @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 FOPException for errors or inconsistencies in the attributes
+ * @throws SAXParseException for errors or inconsistencies in the attributes
*/
- public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
+ public void processNode(String elementName, Locator locator, Attributes attlist) throws SAXParseException {
System.out.println("name = " + elementName);
}
"Local Name: \"" + localName + "\")";
}
+ /**
+ * Helper function to standardize "too many" error exceptions
+ * (e.g., two fo:declarations within fo:root)
+ * @param loc org.xml.sax.Locator object of the error (*not* parent node)
+ * @param offendingNode incoming node that would cause a duplication.
+ */
+ protected void attributeError(String problem)
+ throws SAXParseException {
+ throw new SAXParseException (errorText(locator) + getName() + ", " +
+ problem, locator);
+ }
+
/**
* Helper function to standardize "too many" error exceptions
* (e.g., two fo:declarations within fo:root)
*/
protected void missingChildElementError(String contentModel)
throws SAXParseException {
- throw new SAXParseException(errorText(line, column) + getName() +
+ throw new SAXParseException(errorText(locator) + getName() +
" is missing child elements. \nRequired Content Model: "
- + contentModel, null, null, line, column);
+ + contentModel, locator);
}
/**
return "Error(" + loc.getLineNumber() + "/" + loc.getColumnNumber() + "): ";
}
}
-
- /**
- * Helper function to return "Error (line#/column#)" string for
- * above exception messages
- * @param lineNumber - line number of node with error
- * @param columnNumber - column number of node with error
- * @return String opening error text
- */
- protected static String errorText(int lineNumber, int columnNumber) {
- return "Error(" + lineNumber + "/" + columnNumber + "): ";
- }
}
foNode.processNode(localName, locator, attlist);
} catch (IllegalArgumentException e) {
throw new SAXException(e);
- } catch (FOPException e) {
- throw new SAXException(e);
}
if (rootFObj == null) {
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.Property;
import org.apache.fop.fo.properties.PropertyMaker;
import org.apache.fop.layoutmgr.AddLMVisitor;
+
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) throws FOPException {
+ Attributes attlist) throws SAXParseException {
setLocation(locator);
addProperties(attlist);
}
* Set properties for this FO based on node attributes
* @param attlist Collection of attributes passed to us from the parser.
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
FObj parentFO = findNearestAncestorFObj();
PropertyList parentPL = null;
* @param attributes Collection of attributes passed to us from the parser.
* @throws FOPException If an error occurs while building the PropertyList
*/
- public void addAttributesToList(Attributes attributes)
- throws FOPException {
+ public void addAttributesToList(Attributes attributes) {
/*
* If font-size is set on this FO, must set it first, since
* other attributes specified in terms of "ems" depend on it.
// XML
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist) throws FOPException {
+ Attributes attlist) throws SAXParseException {
super.processNode(elementName, locator, attlist);
init();
}
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;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
/**
* @see org.apache.fop.fo.FONode#processNode
*/
- public void processNode(String elementName, Locator locator, Attributes attlist) throws FOPException {
- setLocation(locator);
- name = elementName;
- attr = attlist;
+ public void processNode(String elementName, Locator locator,
+ Attributes attlist) throws SAXParseException {
+ setLocation(locator);
+ name = elementName;
+ attr = attlist;
}
/**
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import java.util.ArrayList;
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
/**
*
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
internalDestination =
attlist.getValue("internal-destination");
externalDestination =
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import org.apache.batik.dom.svg.SVGOMDocument;
import org.apache.batik.dom.svg.SVGOMElement;
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) throws FOPException {
+ Attributes attlist) throws SAXParseException {
super.processNode(elementName, locator, attlist);
init();
}
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
+
+ setupID();
+ String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString();
+ String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString();
+
+ // per spec, internal takes precedence if both specified
+ if (internal.length() > 0) {
+ link = internal;
+ } else if (ext.length() > 0) {
+ link = ext;
+ external = true;
+ } else {
+ // slightly stronger than spec "should be specified"
+ attributeError("Missing attribute: Either external-destination or " +
+ "internal-destination must be specified.");
+ }
+
getFOInputHandler().startLink(this);
}
return "fo:basic-link";
}
- /**
- * @todo check if needed; not being called currently
- */
- private void setup() {
- String destination;
- int linkType;
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Margin Properties-Inline
- CommonMarginInline mProps = propMgr.getMarginInlineProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps = propMgr.getRelativePositionProps();
-
- String ext = propertyList.get(PR_EXTERNAL_DESTINATION).getString();
- setupID();
-
- String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString();
-
- if (ext.length() > 0) {
- link = ext;
- external = true;
- } else if (internal.length() > 0) {
- link = internal;
- } else {
- getLogger().error("basic-link requires an internal or external destination");
- }
- }
-
/**
* @return true (BasicLink can contain Markers)
*/
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
- setup();
aLMV.serveBasicLink(this);
}
}
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.CharIterator;
import org.apache.fop.fo.FONode;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
this.wsTreatment =
this.propertyList.get(PR_LINEFEED_TREATMENT).getEnum();
setupID();
+ this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+ this.alignLast =
+ this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
+ this.lineHeight = this.propertyList.get(
+ PR_LINE_HEIGHT).getLength().getValue();
+ this.startIndent = this.propertyList.get(
+ PR_START_INDENT).getLength().getValue();
+ this.endIndent = this.propertyList.get(
+ PR_END_INDENT).getLength().getValue();
+ this.spaceBefore = this.propertyList.get(
+ PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
+ this.spaceAfter = this.propertyList.get(
+ PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
+ this.textIndent = this.propertyList.get(
+ PR_TEXT_INDENT).getLength().getValue();
+ this.keepWithNext =
+ this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum();
+
+ this.blockWidows =
+ this.propertyList.get(PR_WIDOWS).getNumber().intValue();
+ this.blockOrphans =
+ this.propertyList.get(PR_ORPHANS).getNumber().intValue();
getFOInputHandler().startBlock(this);
}
- private void setup() {
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Font Properties
- //this.fontState = propMgr.getFontState(area.getFontInfo());
-
- // Common Hyphenation Properties
- CommonHyphenation mHyphProps = propMgr.getHyphenationProps();
-
- // Common Margin Properties-Block
- CommonMarginBlock mProps = propMgr.getMarginProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps =
- propMgr.getRelativePositionProps();
-
- // this.propertyList.get("break-after");
- // this.propertyList.get("break-before");
- // this.propertyList.get("color");
- // this.propertyList.get("text-depth");
- // this.propertyList.get("text-altitude");
- // this.propertyList.get("hyphenation-keep");
- // this.propertyList.get("hyphenation-ladder-count");
- setupID();
- // this.propertyList.get("keep-together");
- // this.propertyList.get("keep-with-next");
- // this.propertyList.get("keep-with-previous");
- // this.propertyList.get("last-line-end-indent");
- // this.propertyList.get("linefeed-treatment");
- // this.propertyList.get("line-height");
- // this.propertyList.get("line-height-shift-adjustment");
- // this.propertyList.get("line-stacking-strategy");
- // this.propertyList.get("orphans");
- // this.propertyList.get("white-space-treatment");
- // this.propertyList.get("span");
- // this.propertyList.get("text-align");
- // this.propertyList.get("text-align-last");
- // this.propertyList.get("text-indent");
- // this.propertyList.get("visibility");
- // this.propertyList.get("white-space-collapse");
- // this.propertyList.get("widows");
- // this.propertyList.get("wrap-option");
- // this.propertyList.get("z-index");
-
- this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
- this.alignLast =
- this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
- this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
- this.lineHeight = this.propertyList.get(
- PR_LINE_HEIGHT).getLength().getValue();
- this.startIndent = this.propertyList.get(
- PR_START_INDENT).getLength().getValue();
- this.endIndent = this.propertyList.get(
- PR_END_INDENT).getLength().getValue();
- this.spaceBefore = this.propertyList.get(
- PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
- this.spaceAfter = this.propertyList.get(
- PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
- this.textIndent = this.propertyList.get(
- PR_TEXT_INDENT).getLength().getValue();
- this.keepWithNext =
- this.propertyList.get(PR_KEEP_WITH_NEXT).getEnum();
-
- this.blockWidows =
- this.propertyList.get(PR_WIDOWS).getNumber().intValue();
- this.blockOrphans =
- this.propertyList.get(PR_ORPHANS).getNumber().intValue();
-
- }
-
/**
* @return true (Block can contain Markers)
*/
package org.apache.fop.fo.flow;
// 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.properties.CommonMarginBlock;
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
/**
* Class modelling the fo:block-container object. See Sec. 6.5.3 of the XSL-FO
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.span = this.propertyList.get(PR_SPAN).getEnum();
setupID();
import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().image(this);
}
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObj;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startFootnote(this);
}
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.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startFootnoteBody(this);
}
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:flow")) {
- throw new FOPException("inline formatting objects cannot"
- + " be directly under flow");
+ throw new SAXParseException("inline formatting objects cannot"
+ + " be directly under flow", locator);
}
// Common Accessibility Properties
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginInline;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
// Common Border, Padding, and Background Properties
CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
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;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
+ setupID();
+
+ this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+ this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
+ this.lineHeight =
+ this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
+ this.startIndent =
+ this.propertyList.get(PR_START_INDENT).getLength().getValue();
+ this.endIndent =
+ this.propertyList.get(PR_END_INDENT).getLength().getValue();
+ this.spaceBefore =
+ this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
+ this.spaceAfter =
+ this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
+ this.spaceBetweenListRows = 0; // not used at present
+ this.backgroundColor =
+ this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
getFOInputHandler().startList(this);
}
- private void setup() throws FOPException {
-
- // Common Accessibility Properties
- CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
-
- // Common Aural Properties
- CommonAural mAurProps = propMgr.getAuralProps();
-
- // Common Border, Padding, and Background Properties
- CommonBorderAndPadding bap = propMgr.getBorderAndPadding();
- CommonBackground bProps = propMgr.getBackgroundProps();
-
- // Common Margin Properties-Block
- CommonMarginBlock mProps = propMgr.getMarginProps();
-
- // Common Relative Position Properties
- CommonRelativePosition mRelProps = propMgr.getRelativePositionProps();
-
- // this.propertyList.get("break-after");
- // this.propertyList.get("break-before");
- setupID();
- // this.propertyList.get("keep-together");
- // this.propertyList.get("keep-with-next");
- // this.propertyList.get("keep-with-previous");
- // this.propertyList.get("provisional-distance-between-starts");
- // this.propertyList.get("provisional-label-separation");
-
- this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
- this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
- this.lineHeight =
- this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
- this.startIndent =
- this.propertyList.get(PR_START_INDENT).getLength().getValue();
- this.endIndent =
- this.propertyList.get(PR_END_INDENT).getLength().getValue();
- this.spaceBefore =
- this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
- this.spaceAfter =
- this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
- this.spaceBetweenListRows = 0; // not used at present
- this.backgroundColor =
- this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
-
- }
-
/**
* @return false (ListBlock does not generate inline areas)
*/
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startListItem(this);
}
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.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
getFOInputHandler().startListLabel();
}
// XML
import org.xml.sax.Attributes;
+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.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.markerClassName =
this.propertyList.get(PR_MARKER_CLASS_NAME).getString();
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.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setup();
getFOInputHandler().startPageNumber(this);
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.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.retrieveClassName =
this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString();
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;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startTable(this);
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;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startBody(this);
}
- private void setup() throws FOPException {
+ private void setup() {
// Common Accessibility Properties
CommonAccessibility mAccProps = propMgr.getAccessibilityProps();
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;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
doSetup(); // init some basic property values
getFOInputHandler().startCell(this);
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#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
initialize(); // init some basic property values
getFOInputHandler().startColumn(this);
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.KeepValue;
import org.apache.fop.fo.FONode;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
setupID();
getFOInputHandler().startRow(this);
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A conditional-page-master-reference formatting object.
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
setMasterName(getProperty(PR_MASTER_REFERENCE).getString());
* @param parent parent node
* @throws FOPException If the parent is invalid
*/
- protected void validateParent(FONode parent) throws FOPException {
+ protected void validateParent(FONode parent) throws SAXParseException {
if (parent.getName().equals("fo:repeatable-page-master-alternatives")) {
this.repeatablePageMasterAlternatives =
(RepeatablePageMasterAlternatives)parent;
this.repeatablePageMasterAlternatives.addConditionalPageMasterReference(this);
}
} else {
- throw new FOPException("fo:conditional-page-master-reference must be child "
+ throw new SAXParseException("fo:conditional-page-master-reference must be child "
+ "of fo:repeatable-page-master-alternatives, not "
- + parent.getName());
+ + parent.getName(), locator);
}
}
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard.
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:page-sequence")) {
this.pageSequence = (PageSequence) parent;
} else {
- throw new FOPException("flow must be child of "
- + "page-sequence, not " + parent.getName());
+ throw new SAXParseException("flow must be child of "
+ + "page-sequence, not " + parent.getName(), locator);
}
// according to communication from Paul Grosso (XSL-List,
// 001228, Number 406), confusion in spec section 6.4.5 about
* @param name the name of the flow to set
* @throws FOPException for an empty name
*/
- protected void setFlowName(String name) throws FOPException {
+ protected void setFlowName(String name) throws SAXParseException {
if (name == null || name.equals("")) {
- throw new FOPException("A 'flow-name' is required for "
- + getName());
+ throw new SAXParseException("A 'flow-name' is required for "
+ + getName(), locator);
} else {
flowName = name;
}
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:root")) {
Root root = (Root)parent;
root.setLayoutMasterSet(this);
} else {
- throw new FOPException("fo:layout-master-set must be child of fo:root, not "
- + parent.getName());
+ throw new SAXParseException("fo:layout-master-set must be child of fo:root, not "
+ + parent.getName(), locator);
}
this.simplePageMasters = new java.util.HashMap();
/**
* 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 FOPException if there's a name duplication
+ * @throws SAXParseException if there's a name duplication
*/
- public void checkRegionNames() throws FOPException {
+ public void checkRegionNames() throws SAXParseException {
// (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 FOPException("Region-name ("
+ throw new SAXParseException("Region-name ("
+ region.getRegionName()
+ ") is being mapped to multiple "
+ "region-classes ("
+ defaultRegionName + " and "
+ region.getDefaultRegionName()
- + ")");
+ + ")", locator);
}
}
allRegions.put(region.getRegionName(),
// SAX
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (getProperty(PR_MASTER_REFERENCE) != null) {
this.masterName = getProperty(PR_MASTER_REFERENCE).getString();
* @param parent parent node
* @throws FOPException If the parent is invalid.
*/
- protected void validateParent(FONode parent) throws FOPException {
+ protected void validateParent(FONode parent) throws SAXParseException {
if (parent.getName().equals("fo:page-sequence-master")) {
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
}
} else {
- throw new FOPException(getName() + " must be"
+ throw new SAXParseException(getName() + " must be"
+ "child of fo:page-sequence-master, not "
- + parent.getName());
+ + parent.getName(), 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.FOElementMapping;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
this.root = (Root) parent;
int pageStart = new Integer(ipnValue).intValue();
this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1;
} catch (NumberFormatException nfe) {
- throw new FOPException("\"" + ipnValue
- + "\" is not a valid value for initial-page-number");
+ throw new SAXParseException("\"" + ipnValue
+ + "\" is not a valid value for initial-page-number", locator);
}
}
this.pageSequenceMaster =
this.layoutMasterSet.getPageSequenceMaster(masterName);
if (this.pageSequenceMaster == null) {
- throw new FOPException("master-reference '" + masterName
+ throw new SAXParseException("master-reference '" + masterName
+ "' for fo:page-sequence matches no"
- + " simple-page-master or page-sequence-master");
+ + " simple-page-master or page-sequence-master", locator);
}
}
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
subSequenceSpecifiers = new java.util.ArrayList();
if (parent.getName().equals("fo:layout-master-set")) {
getLogger().warn("page-sequence-master does not have "
+ "a master-name and so is being ignored");
} else {
- this.layoutMasterSet.addPageSequenceMaster(masterName, this);
+ try {
+ this.layoutMasterSet.addPageSequenceMaster(masterName, this);
+ } catch (Exception e) {
+ throw new SAXParseException("Error with adding Page Sequence Master: "
+ + e.getMessage(), locator);
+ }
}
} else {
- throw new FOPException("fo:page-sequence-master must be child "
+ throw new SAXParseException("fo:page-sequence-master must be child "
+ "of fo:layout-master-set, not "
- + parent.getName());
+ + parent.getName(), locator);
}
}
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
// regions may have name, or default
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
- throw new FOPException("region-name '" + regionName
+ throw new SAXParseException("region-name '" + regionName
+ "' for " + this.getName()
- + " not permitted.");
+ + " not permitted.", locator);
}
}
if (parent instanceof SimplePageMaster) {
layoutMaster = (SimplePageMaster)parent;
} else {
- throw new FOPException(this.getName() + " must be child "
+ throw new SAXParseException(this.getName() + " must be child "
+ "of simple-page-master, not "
- + parent.getName());
+ + parent.getName(), locator);
}
this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum();
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A repeatable-page-master-alternatives formatting object.
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
conditionalPageMasterRefs = new ArrayList();
PageSequenceMaster pageSequenceMaster = (PageSequenceMaster)parent;
pageSequenceMaster.addSubsequenceSpecifier(this);
} else {
- throw new FOPException("fo:repeatable-page-master-alternatives "
+ throw new SAXParseException("fo:repeatable-page-master-alternatives "
+ "must be child of fo:page-sequence-master, not "
- + parent.getName());
+ + parent.getName(), locator);
}
String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
- throw new FOPException("Invalid number for "
- + "'maximum-repeats' property");
+ throw new SAXParseException("Invalid number for "
+ + "'maximum-repeats' property", locator);
}
}
}
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A repeatable-page-master-reference formatting object.
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
String mr = getProperty(PR_MAXIMUM_REPEATS).getString();
if (mr.equals("no-limit")) {
this.maximumRepeats = 0;
}
} catch (NumberFormatException nfe) {
- throw new FOPException("Invalid number for "
- + "'maximum-repeats' property");
+ throw new SAXParseException("Invalid number for "
+ + "'maximum-repeats' property", locator);
}
}
}
// XML
import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
-import org.apache.fop.apps.FOPException;
/**
* A simple-page-master formatting object.
/**
* @see org.apache.fop.fo.FObj#addProperties
*/
- protected void addProperties(Attributes attlist) throws FOPException {
+ protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
if (parent.getName().equals("fo:layout-master-set")) {
getLogger().warn("simple-page-master does not have "
+ "a master-name and so is being ignored");
} else {
- layoutMasterSet.addSimplePageMaster(this);
+ try {
+ layoutMasterSet.addSimplePageMaster(this);
+ } catch (Exception e) {
+ throw new SAXParseException("Error with adding Page Sequence Master: "
+ + e.getMessage(), locator);
+ }
}
} else {
- throw new FOPException("fo:simple-page-master must be child "
+ throw new SAXParseException("fo:simple-page-master must be child "
+ "of fo:layout-master-set, not "
- + parent.getName());
+ + parent.getName(), locator);
}
//Well, there are only 5 regions so we can save a bit of memory here
regions = new HashMap(5);
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
* @param name the flow-name to set
* @throws FOPException for a missing flow name
*/
- protected void setFlowName(String name) throws FOPException {
+ protected void setFlowName(String name) throws SAXParseException {
if (name == null || name.equals("")) {
- throw new FOPException("A 'flow-name' is required for "
- + getName() + ".");
+ throw new SAXParseException("A 'flow-name' is required for "
+ + getName() + ".", locator);
} else {
super.setFlowName(name);
}