// FOP
import org.apache.fop.fo.FOTreeBuilder;
import org.apache.fop.fo.ElementMapping;
-import org.apache.fop.fo.PropertyListMapping;
import org.apache.fop.layout.AreaTree;
import org.apache.fop.layout.FontInfo;
import org.apache.fop.render.Renderer;
/** the system resources that FOP will use */
private BufferManager _bufferManager;
+ public static final String getParserClassName() {
+ String parserClassName = null;
+ try {
+ parserClassName = System.getProperty("org.xml.sax.parser");
+ } catch(SecurityException se) {
+ }
+ if (parserClassName == null) {
+ parserClassName = "org.apache.xerces.parsers.SAXParser";
+ }
+ return parserClassName;
+ }
+
/** create a new Driver */
public Driver() {
_stream = null;
_reader = reader;
}
-
/**
* Sets all the element and property list mappings to their default values.
*
*/
public void setupDefaultMappings() {
addElementMapping("org.apache.fop.fo.StandardElementMapping");
- addPropertyList ("org.apache.fop.fo.StandardPropertyListMapping");
-
addElementMapping("org.apache.fop.svg.SVGElementMapping");
- addPropertyList ("org.apache.fop.svg.SVGPropertyListMapping");
-
addElementMapping("org.apache.fop.extensions.ExtensionElementMapping");
- addPropertyList ("org.apache.fop.extensions.ExtensionPropertyListMapping");
- // add mappings from user configuration
- Hashtable mappings = Configuration.getHashtableValue("mappings");
- if (mappings != null) {
- String prop = (String) mappings.get("property");
- String ele = (String) mappings.get("element");
- try {
- addElementMapping(ele);
- addPropertyList(prop);
- } catch (IllegalArgumentException e) {
+ // add mappings from available services
+ Enumeration providers = Service.providers(org.apache.fop.fo.ElementMapping.class);
+ if (providers != null) {
+ while(providers.hasMoreElements()) {
+ String str = (String)providers.nextElement();
+ try {
+ addElementMapping(str);
+ } catch (IllegalArgumentException e) {
+ }
}
}
}
}
-
/**
* Set the Renderer to use
* @param renderer the renderer instance to use
}
}
- /**
- * Add the PropertyListMapping.
- */
- public void addPropertyList(PropertyListMapping mapping) {
- mapping.addToBuilder(_treeBuilder);
- }
-
- /**
- * Add the PropertyListMapping with the given class name.
- */
- public void addPropertyList(String listClassName)
- throws IllegalArgumentException {
- try {
- PropertyListMapping mapping =
- (PropertyListMapping) Class.forName(
- listClassName).newInstance();
- addPropertyList(mapping);
-
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Could not find " +
- listClassName);
- }
- catch (InstantiationException e) {
- throw new IllegalArgumentException(
- "Could not instantiate " + listClassName);
- }
- catch (IllegalAccessException e) {
- throw new IllegalArgumentException("Could not access " +
- listClassName);
- }
- catch (ClassCastException e) {
- throw new IllegalArgumentException(listClassName + " is not an ElementMapping");
- }
- }
-
/**
* Returns the tree builder (a SAX ContentHandler).
*
format();
render();
}
+}
+
+// code stolen from org.apache.batik.util and modified slightly
+// does what sun.misc.Service probably does, but it cannot be relied on.
+// hopefully will be part of standard jdk sometime.
+/**
+ * This class loads services present in the class path.
+ */
+class Service {
+
+ static Hashtable providerMap = new Hashtable();
+ public static synchronized Enumeration providers(Class cls) {
+ ClassLoader cl = cls.getClassLoader();
+ String serviceFile = "META-INF/services/"+cls.getName();
+
+ // System.out.println("File: " + serviceFile);
+
+ Vector v = (Vector)providerMap.get(serviceFile);
+ if (v != null)
+ return v.elements();
+
+ v = new Vector();
+ providerMap.put(serviceFile, v);
+
+ Enumeration e;
+ try {
+ e = cl.getResources(serviceFile);
+ } catch (IOException ioe) {
+ return v.elements();
+ }
+
+ while (e.hasMoreElements()) {
+ try {
+ java.net.URL u = (java.net.URL)e.nextElement();
+ // System.out.println("URL: " + u);
+
+ InputStream is = u.openStream();
+ Reader r = new InputStreamReader(is, "UTF-8");
+ BufferedReader br = new BufferedReader(r);
+
+ String line = br.readLine();
+ while (line != null) {
+ try {
+ // First strip any comment...
+ int idx = line.indexOf('#');
+ if (idx != -1)
+ line = line.substring(0, idx);
+
+ // Trim whitespace.
+ line = line.trim();
+
+ // If nothing left then loop around...
+ if (line.length() == 0) {
+ line = br.readLine();
+ continue;
+ }
+ // System.out.println("Line: " + line);
+
+ // Try and load the class
+ //Object obj = cl.loadClass(line).newInstance();
+ // stick it into our vector...
+ v.add(line);
+ } catch (Exception ex) {
+ // Just try the next line
+ }
+ line = br.readLine();
+ }
+ } catch (Exception ex) {
+ // Just try the next file...
+ }
+ }
+ return v.elements();
+ }
}
+
/*
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
*/
-
package org.apache.fop.configuration;
import java.util.Vector;
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+/* $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
*/
package org.apache.fop.configuration;
import org.xml.sax.InputSource;
//fop
+import org.apache.fop.apps.Driver;
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.apps.FOPException;
import org.apache.fop.configuration.Configuration;
* Once the configuration has been setup, the information can be accessed with
* the methods of StandardConfiguration.
*/
-
public class ConfigurationReader {
/** show a full dump on error */
private static boolean errorDump = false;
this.filename = filename;
}
-
/**
- * intantiates parser and starts parsing of config file
- */
+ * intantiates parser and starts parsing of config file
+ */
public void start () throws FOPException {
XMLReader parser = createParser();
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
false);
} catch (SAXException e) {
- throw new FOPException("You need a parser which supports SAX version 2",e);
+ throw new FOPException("You need a parser which supports SAX version 2",e);
}
ConfigurationParser configurationParser = new ConfigurationParser();
parser.setContentHandler(configurationParser);
}
}
-
/**
- * creates a SAX parser, using the value of org.xml.sax.parser
- * defaulting to org.apache.xerces.parsers.SAXParser
- *
- * @return the created SAX parser
- */
- public static XMLReader createParser()
- throws FOPException
- {
- String parserClassName = System.getProperty("org.xml.sax.parser");
- if (parserClassName == null) {
- parserClassName = "org.apache.xerces.parsers.SAXParser";
- }
+ * creates a SAX parser, using the value of org.xml.sax.parser
+ * defaulting to org.apache.xerces.parsers.SAXParser
+ *
+ * @return the created SAX parser
+ */
+ public static XMLReader createParser() throws FOPException {
+ String parserClassName = Driver.getParserClassName();
if (errorDump) {
MessageHandler.logln( "configuration reader using SAX parser " +
parserClassName);
return (XMLReader) Class.forName(
parserClassName).newInstance();
} catch (ClassNotFoundException e) {
- throw new FOPException("Could not find " + parserClassName,e);
+ throw new FOPException("Could not find " + parserClassName, e);
}
catch (InstantiationException e) {
throw new FOPException("Could not instantiate " +
- parserClassName,e);
+ parserClassName, e);
}
catch (IllegalAccessException e) {
- throw new FOPException("Could not access " + parserClassName,e);
+ throw new FOPException("Could not access " +
+ parserClassName, e);
}
catch (ClassCastException e) {
throw new FOPException(parserClassName + " is not a SAX driver",e);
}
/**
- * Dumps an error
- */
+ * Dumps an error
+ */
public void dumpError(Exception e) {
if (errorDump) {
if (e instanceof SAXException) {
}
}
}
-
/**
- * long or short error messages
- *
- */
+ * long or short error messages
+ *
+ */
public void setDumpError(boolean dumpError) {
errorDump = dumpError;
}
-
}
-/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+/* $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
*/
package org.apache.fop.extensions;
import org.apache.fop.fo.*;
+import org.apache.fop.fo.properties.ExtensionPropertyMapping;
+import org.apache.fop.fo.TreeBuilder;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
public class ExtensionElementMapping implements ElementMapping {
public static final String URI = "http://xml.apache.org/fop/extensions";
public void addToBuilder(TreeBuilder builder) {
- builder.addMapping(URI, "outline", Outline.maker());
- builder.addMapping(URI, "label", Label.maker());
+ builder.addMapping(URI, "outline", Outline.maker());
+ builder.addMapping(URI, "label", Label.maker());
+
+
+ builder.addPropertyList(ExtensionElementMapping.URI,
+ ExtensionPropertyMapping.getGenericMappings());
+ /* Add any element mappings */
+ for (Enumeration e = ExtensionPropertyMapping.getElementMappings();
+ e.hasMoreElements();) {
+ String elem = (String) e.nextElement();
+ builder.addElementPropertyList(ExtensionElementMapping.URI,
+ elem, ExtensionPropertyMapping.getElementMapping(
+ elem));
+ }
}
}
-/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+/*-- $Id$ --
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
*/
+
package org.apache.fop.fo;
+/**
+ * Interface for adding supported element and property mappings to
+ * the given builder.
+ */
public interface ElementMapping {
-
public void addToBuilder(TreeBuilder builder);
}
/*-- $Id$ --
- *
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
*/
package org.apache.fop.fo;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import org.apache.fop.fo.properties.FOPropertyMapping;
import org.apache.fop.fo.flow.*;
import org.apache.fop.fo.pagination.*;
public void addToBuilder(TreeBuilder builder) {
- String uri = "http://www.w3.org/1999/XSL/Format";
+ String uri = "http://www.w3.org/1999/XSL/Format";
- builder.addMapping(uri, "root", Root.maker());
- builder.addMapping(uri, "layout-master-set",
- LayoutMasterSet.maker());
- builder.addMapping(uri, "simple-page-master",
- SimplePageMaster.maker());
- builder.addMapping(uri, "region-body", RegionBody.maker());
- builder.addMapping(uri, "region-before", RegionBefore.maker());
- builder.addMapping(uri, "region-after", RegionAfter.maker());
- builder.addMapping(uri, "region-start", RegionStart.maker());
- builder.addMapping(uri, "region-end", RegionEnd.maker());
- builder.addMapping(uri, "page-sequence", PageSequence.maker());
- builder.addMapping(uri, "page-sequence-master",
- PageSequenceMaster.maker());
- builder.addMapping(uri, "single-page-master-reference",
- SinglePageMasterReference.maker());
- builder.addMapping(uri, "repeatable-page-master-reference",
- RepeatablePageMasterReference.maker());
- builder.addMapping(uri, "conditional-page-master-reference",
- ConditionalPageMasterReference.maker());
- builder.addMapping(uri, "repeatable-page-master-alternatives",
- RepeatablePageMasterAlternatives.maker());
- builder.addMapping(uri, "flow", Flow.maker());
- builder.addMapping(uri, "static-content",
- StaticContent.maker());
- builder.addMapping(uri, "block", Block.maker());
- builder.addMapping(uri, "block-container", BlockContainer.maker());
- builder.addMapping(uri, "list-block", ListBlock.maker());
- builder.addMapping(uri, "list-item", ListItem.maker());
- builder.addMapping(uri, "list-item-label",
- ListItemLabel.maker());
- builder.addMapping(uri, "list-item-body", ListItemBody.maker());
- builder.addMapping(uri, "page-number", PageNumber.maker());
- builder.addMapping(uri, "page-number-citation", PageNumberCitation.maker());
- builder.addMapping(uri, "display-sequence",
- DisplaySequence.maker());
- builder.addMapping(uri, "inline",
- Inline.maker());
- builder.addMapping(uri, "external-graphic",
+ builder.addMapping(uri, "root", Root.maker());
+ builder.addMapping(uri, "layout-master-set",
+ LayoutMasterSet.maker());
+ builder.addMapping(uri, "simple-page-master",
+ SimplePageMaster.maker());
+ builder.addMapping(uri, "region-body", RegionBody.maker());
+ builder.addMapping(uri, "region-before", RegionBefore.maker());
+ builder.addMapping(uri, "region-after", RegionAfter.maker());
+ builder.addMapping(uri, "region-start", RegionStart.maker());
+ builder.addMapping(uri, "region-end", RegionEnd.maker());
+ builder.addMapping(uri, "page-sequence", PageSequence.maker());
+ builder.addMapping(uri, "page-sequence-master",
+ PageSequenceMaster.maker());
+ builder.addMapping(uri, "single-page-master-reference",
+ SinglePageMasterReference.maker());
+ builder.addMapping(uri, "repeatable-page-master-reference",
+ RepeatablePageMasterReference.maker());
+ builder.addMapping(uri, "conditional-page-master-reference",
+ ConditionalPageMasterReference.maker());
+ builder.addMapping(uri, "repeatable-page-master-alternatives",
+ RepeatablePageMasterAlternatives.maker());
+ builder.addMapping(uri, "flow", Flow.maker());
+ builder.addMapping(uri, "static-content", StaticContent.maker());
+ builder.addMapping(uri, "block", Block.maker());
+ builder.addMapping(uri, "block-container", BlockContainer.maker());
+ builder.addMapping(uri, "list-block", ListBlock.maker());
+ builder.addMapping(uri, "list-item", ListItem.maker());
+ builder.addMapping(uri, "list-item-label", ListItemLabel.maker());
+ builder.addMapping(uri, "list-item-body", ListItemBody.maker());
+ builder.addMapping(uri, "page-number", PageNumber.maker());
+ builder.addMapping(uri, "page-number-citation",
+ PageNumberCitation.maker());
+ builder.addMapping(uri, "display-sequence",
+ DisplaySequence.maker());
+ builder.addMapping(uri, "inline", Inline.maker());
+ builder.addMapping(uri, "external-graphic",
ExternalGraphic.maker());
- builder.addMapping(uri, "table", Table.maker());
- builder.addMapping(uri, "table-column", TableColumn.maker());
- builder.addMapping(uri, "table-header", TableHeader.maker());
- builder.addMapping(uri, "table-body", TableBody.maker());
- builder.addMapping(uri, "table-footer", TableFooter.maker());
- builder.addMapping(uri, "table-row", TableRow.maker());
- builder.addMapping(uri, "table-cell", TableCell.maker());
- builder.addMapping(uri, "basic-link", BasicLink.maker());
- builder.addMapping(uri, "instream-foreign-object", InstreamForeignObject.maker());
- builder.addMapping(uri, "leader", Leader.maker());
- builder.addMapping(uri, "character", org.apache.fop.fo.flow.Character.maker());
- builder.addMapping(uri, "footnote", Footnote.maker());
- builder.addMapping(uri, "footnote-body", FootnoteBody.maker());
- builder.addMapping(uri, "wrapper", Wrapper.maker());
+ builder.addMapping(uri, "table", Table.maker());
+ builder.addMapping(uri, "table-column", TableColumn.maker());
+ builder.addMapping(uri, "table-header", TableHeader.maker());
+ builder.addMapping(uri, "table-body", TableBody.maker());
+ builder.addMapping(uri, "table-footer", TableFooter.maker());
+ builder.addMapping(uri, "table-row", TableRow.maker());
+ builder.addMapping(uri, "table-cell", TableCell.maker());
+ builder.addMapping(uri, "basic-link", BasicLink.maker());
+ builder.addMapping(uri, "instream-foreign-object",
+ InstreamForeignObject.maker());
+ builder.addMapping(uri, "leader", Leader.maker());
+ builder.addMapping(uri, "character",
+ org.apache.fop.fo.flow.Character.maker());
+ builder.addMapping(uri, "footnote", Footnote.maker());
+ builder.addMapping(uri, "footnote-body", FootnoteBody.maker());
+ builder.addMapping(uri, "wrapper", Wrapper.maker());
+
+
+ builder.addPropertyList(uri,
+ FOPropertyMapping.getGenericMappings());
+ /* Add any element mappings */
+ for (Enumeration e = FOPropertyMapping.getElementMappings();
+ e.hasMoreElements();) {
+ String elem = (String) e.nextElement();
+ builder.addElementPropertyList(uri, elem,
+ FOPropertyMapping.getElementMapping(elem));
+ }
+
}
}
import org.w3c.dom.svg.SVGDocument;
// FOP
+import org.apache.fop.apps.Driver;
import org.apache.fop.messaging.*;
import org.apache.fop.datatypes.ColorSpace;
import org.apache.fop.pdf.PDFColor;
* @return the created SAX parser
*/
public static String getParserName() {
- String parserClassName = System.getProperty("org.xml.sax.parser");
- if (parserClassName == null) {
- parserClassName = "org.apache.xerces.parsers.SAXParser";
- }
+ String parserClassName = Driver.getParserClassName();
return parserClassName;
}
* Returns the class name of the XML parser.
*/
public String getXMLParserClassName() {
- String parserClassName = System.getProperty("org.xml.sax.parser");
- if (parserClassName == null) {
- parserClassName = "org.apache.xerces.parsers.SAXParser";
- }
- return parserClassName;//application.getXMLParserClassName();
+ return Driver.getParserClassName();
}
/**
* Returns the class name of the XML parser.
*/
public String getXMLParserClassName() {
- String parserClassName = System.getProperty("org.xml.sax.parser");
- if (parserClassName == null) {
- parserClassName = "org.apache.xerces.parsers.SAXParser";
- }
- return parserClassName;//application.getXMLParserClassName();
+ return org.apache.fop.apps.Driver.getParserClassName();
}
/**
comment("% --- SVG Area");
write("gsave");
if (w != 0 && h != 0) {
-/* write("newpath");
+ write("newpath");
write(x / 1000f + " " + y / 1000f + " M");
write((x + w) / 1000f + " " + y / 1000f + " rlineto");
write((x + w) / 1000f + " " + (y - h) / 1000f +
write(x / 1000f + " " + (y - h) / 1000f + " rlineto");
write("closepath");
write("clippath");
-*/ }
+ }
// transform so that the coordinates (0,0) is from the top left
// and positive is down and to the right. (0,0) is where the
// viewBox puts it.
* Returns the class name of the XML parser.
*/
public String getXMLParserClassName() {
- String parserClassName = System.getProperty("org.xml.sax.parser");
- if (parserClassName == null) {
- parserClassName = "org.apache.xerces.parsers.SAXParser";
- }
- return parserClassName;//application.getXMLParserClassName();
+ return org.apache.fop.apps.Driver.getParserClassName();
}
/**
/* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
*/
package org.apache.fop.svg;
+import java.util.Enumeration;
+
+import org.apache.fop.fo.properties.SVGPropertyMapping;
import org.apache.fop.fo.TreeBuilder;
import org.apache.fop.fo.FOTreeBuilder;
import org.apache.fop.fo.ElementMapping;
builder.addMapping(uri, "feOffset", FeOffset.maker());
builder.addMapping(uri, "feMerge", FeMerge.maker());
builder.addMapping(uri, "feMergeNode", FeMergeNode.maker());
+
+
+ builder.addPropertyList(uri,
+ SVGPropertyMapping.getGenericMappings());
+ /* Add any element mappings */
+ for (Enumeration e = SVGPropertyMapping.getElementMappings();
+ e.hasMoreElements();) {
+ String elem = (String) e.nextElement();
+ builder.addElementPropertyList(uri, elem,
+ SVGPropertyMapping.getElementMapping(elem));
+ }
}
}