Greetings all,

I'm learning to write extensions and I'm trying to start simple.
I think I've followed the directions on the "Extensions" page
(, but something
is still missing or incorrect.

I'm using JDK build 1.4.0-beta3-b84 with Fop0.20.2 on
Windows 2000, Service Pack 3.

I have a Java class to simply output the Date in the default
locale.  Eventually I'll need to get content from log files and
database tables,  etc., but I just want to see output from my
extension class show up in the rendered result right now.

I have an ElementMapping subclass that parallels
the functionality used to support the fox:label tag.

I have a single line of text in the text file
with the fully qualified class name for that ElementMapping


I stored the jar in my Fop-0.20.2\lib\ directory.

My stylesheet element includes the attributes

When I try to use <pob:time /> in the fo file, there is no output
in pdf or awt. There are no more error messages about
Transformer errors or ClassNotFoundExceptions, so I
think I'm getting closer. Everything else I do in that file
works (png images, pdf bookmarks and internal links),
so I believe the set up is correct.

I'm doing something wrong or not doing something right <G>

Any help greatly appreciated.



 Functionality class source code:
package gov.census.geo.pob.fop.extensions;

import org.apache.fop.extensions.*;
import java.util.Date;
import java.text.SimpleDateFormat;

public class TimeDisplay extends ExtensionObj {
    private String today = (new SimpleDateFormat()).format(new Date());

    public static class Maker extends FObj.Maker {
        public FObj make(FObj parent, PropertyList propertyList) {
            return new TimeDisplay(parent, propertyList);

    public static FObj.Maker maker() {
        return new TimeDisplay.Maker();

    public TimeDisplay(FObj parent, PropertyList propertyList) {
        super(parent, propertyList);

    public String toString(){
     return (today);

ElementMapping subclass source code:

package gov.census.geo.pob.fop.extensions;


import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;

public class TimeDisplayMapping implements ElementMapping {

    public final static String URI = "";;

    private static HashMap foObjs = null;

    public synchronized void addToBuilder(TreeBuilder builder) {
        if(foObjs == null) {
            foObjs = new HashMap();
            foObjs.put("time", TimeDisplay.maker());
        builder.addMapping(URI, foObjs);

        /* Add any element mappings */
        for (Iterator iter = ExtensionPropertyMapping.getElementMappings
                iter.hasNext(); ) {
            String elem = (String);
            builder.addElementPropertyList(URI, elem,


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to