*
* @param data array of characters containing text to be added
* @param start starting array element to add
- * @param length number of elements to add
+ * @param end ending array element to add
* @param pList currently applicable PropertyList
* @param locator location in the XSL-FO source file.
* @throws FOPException if there's a problem during processing
+ * @deprecated Please override {@code #characters(char[], int, int, PropertyList, Locator)}
+ * instead!
*/
- protected void addCharacters(char[] data, int start, int length,
+ protected void addCharacters(char[] data, int start, int end,
PropertyList pList,
Locator locator) throws FOPException {
// ignore
}
+ /**
+ * Adds characters. Does nothing by default. To be overridden in subclasses
+ * that allow <code>#PCDATA</code> content.
+ *
+ * @param data array of characters containing text to be added
+ * @param start starting array element to add
+ * @param length number of elements to add
+ * @param pList currently applicable PropertyList
+ * @param locator location in the XSL-FO source file.
+ * @throws FOPException if there's a problem during processing
+ */
+ protected void characters(char[] data, int start, int length,
+ PropertyList pList,
+ Locator locator) throws FOPException {
+ addCharacters(data, start, start + length, pList, locator);
+ }
+
/**
* Called after processNode() is called. Subclasses can do additional processing.
*
}
/** {@inheritDoc} */
- protected void addCharacters(char[] data, int start, int length,
+ protected void characters(char[] data, int start, int length,
PropertyList list, Locator locator) throws FOPException {
if (this.charBuffer == null) {
public void characters(char[] data, int start, int length)
throws FOPException {
if (currentFObj != null) {
- currentFObj.addCharacters(data, start, length,
+ currentFObj.characters(data, start, length,
currentPropertyList, getEffectiveLocator());
}
}
}
/** {@inheritDoc} */
- protected void addCharacters(char[] data, int start, int length,
+ protected void characters(char[] data, int start, int length,
PropertyList pList,
Locator locator) throws FOPException {
if (ft == null) {
ft.bind(pList);
}
}
- ft.addCharacters(data, start, length, null, null);
+ ft.characters(data, start, length, null, null);
}
/** {@inheritDoc} */
import org.xml.sax.Locator;
+import org.apache.fop.apps.FOPException;
+
/**
* Class for handling generic XML from a namespace not recognized by FOP
*/
return null; //We don't know that in this case.
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
protected void addChildNode(FONode child) {
if (doc == null) {
createBasicDocument();
super.addChildNode(child);
}
- /**
- * {@inheritDoc}
- */
- protected void addCharacters(char data[], int start, int length,
- PropertyList pList, Locator locator) {
+ /** {@inheritDoc} */
+ protected void characters(char[] data, int start, int length,
+ PropertyList pList, Locator locator) throws FOPException {
if (doc == null) {
createBasicDocument();
}
- super.addCharacters(data, start, length, pList, locator);
+ super.characters(data, start, length, pList, locator);
}
}
import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.datatypes.Length;
-import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
+
/**
* Abstract class modelling generic, non-XSL-FO XML objects. Such objects are
* stored in a DOM.
}
}
- /**
- * Add parsed characters to this object
- *
- * @param data array of characters contaning the text to add
- * @param start starting array element to add
- * @param length number of characters from the array to add
- * @param pList the currently applicable property list
- * @param locator location in fo source file.
- */
- protected void addCharacters(char[] data, int start, int length,
- PropertyList pList, Locator locator) {
+ /** {@inheritDoc} */
+ protected void characters(char[] data, int start, int length,
+ PropertyList pList, Locator locator) throws FOPException {
+ super.characters(data, start, length, pList, locator);
String str = new String(data, start, length);
org.w3c.dom.Text text = doc.createTextNode(str);
element.appendChild(text);
import org.xml.sax.Locator;
-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;
* @param data the character data
* @param start the start position in the data array
* @param length the length of the character array
+ * @param pList currently applicable PropertyList
* @param locator location in fo source file.
*/
- protected void addCharacters(char[] data, int start, int length,
+ protected void characters(char[] data, int start, int length,
PropertyList pList,
Locator locator) {
title += new String(data, start, length);
package org.apache.fop.render.afp.extensions;
// FOP
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
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.fo.extensions.ExtensionAttachment;
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
/**
* Base class for the AFP-specific extension elements.
}
/** {@inheritDoc} */
- protected void addCharacters(char[] data, int start, int end,
+ protected void characters(char[] data, int start, int length,
PropertyList pList, Locator locator) {
- setupCode.setContent(new String(data, start, end - start));
+ setupCode.setContent(new String(data, start, length));
}
/** {@inheritDoc} */
}
}
- /**
- * Adds characters (does nothing here)
- * @param data array of characters containing text to be added
- * @param start starting array element to add
- * @param length of data array to add
- * @param pList currently applicable PropertyList
- * @param locator location in fo source file.
- * @see org.apache.fop.fo.FONode#addCharacters(char[], int, int, PropertyList, Locator)
- */
- protected void addCharacters(char[] data, int start, int length,
+ /** {@inheritDoc} */
+ protected void characters(char[] data, int start, int length,
PropertyList pList, Locator locator) {
PSExtensionAttachment a = (PSExtensionAttachment)getExtensionAttachment();
if (a.getContent() != null) {
StringBuffer sb = new StringBuffer(a.getContent());
- sb.append(data, start, length - start);
+ sb.append(data, start, length);
a.setContent(sb.toString());
} else {
- a.setContent(new String(data, start, length - start));
+ a.setContent(new String(data, start, length));
}
}
}
/** {@inheritDoc} */
- protected void addCharacters(char[] data, int start, int length,
+ protected void characters(char[] data, int start, int length,
PropertyList pList, Locator locator) {
if (setupCode.getContent() != null) {
StringBuffer sb = new StringBuffer(setupCode.getContent());
sb.append(data, start, length - start);
setupCode.setContent(sb.toString());
} else {
- setupCode.setContent(new String(data, start, length - start));
+ setupCode.setContent(new String(data, start, length));
}
}