Hello,

I just tried to build a custom extension for the fop.
So I did the element mapping:

-------------------------------->8--------------------------------------

package com.zf.swdoku.fop.fo.extensions.js;

import java.util.HashMap;
import java.util.Set;

import org.apache.fop.fo.ElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.xmlgraphics.util.QName;

/**
* Element mapping for FOP's proprietary extension to XSL-FO.
*/
public class JSElementMapping extends ElementMapping {

     /** The FOP extension namespace URI */
     public static final String URI = "http://ns.zf.com/SWDoku/fop/ext/js";;

     /** The standard XML prefix for elements and attributes in this namespace. 
*/
     public static final String STANDARD_PREFIX = "js";

     private static final Set<String> PROPERTY_ATTRIBUTES = new 
java.util.HashSet<String>();

     static {
          // These are FOP's standard extension properties (js:*)
          PROPERTY_ATTRIBUTES.add("lang");
     }

     /**
     * Constructor.
     */
     public JSElementMapping() {
          namespaceURI = URI;
     }

     /**
     * Initialize the data structures.
     */
     @Override
     protected void initialize() {
          System.out.println("init JS");
          if (foObjs == null) {
                foObjs = new HashMap<String, Maker>();
                // foObjs.put("script", new UnknownXMLObj.Maker(URI));
                foObjs.put("script", new JSMaker());

          }
     }

     static class JSMaker extends ElementMapping.Maker {
          @Override
          public FONode make(FONode parent) {
                return new Script(parent);
          }
     }

     /** {@inheritDoc} */
     @Override
     public String getStandardPrefix() {
          return STANDARD_PREFIX;
     }

     /** {@inheritDoc} */
     @Override
     public boolean isAttributeProperty(QName attributeName) {
          if (!URI.equals(attributeName.getNamespaceURI())) {
                throw new IllegalArgumentException("The namespace URIs don't 
match");
          }
          return PROPERTY_ATTRIBUTES.contains(attributeName.getLocalName());
     }

}

--------------------------------8<--------------------------------------

But I didn't get it initialized, but why?
I used the FOP 1.1.
Thanks for your help.
Best regards

Markus


Reply via email to