Package org.apache.fop.fo
Class ElementMappingRegistry
- java.lang.Object
-
- org.apache.fop.fo.ElementMappingRegistry
-
public class ElementMappingRegistry extends java.lang.Object
This class keeps track of all configured ElementMapping implementations which are responsible for properly handling all kinds of different XML namespaces.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,ElementMapping.Maker>>
fobjTable
Table mapping element names to the makers of objects representing formatting objects.private static org.apache.commons.logging.Log
LOG
logging instanceprotected java.util.Map<java.lang.String,ElementMapping>
namespaces
Map of mapped namespaces and their associated ElementMapping instances.
-
Constructor Summary
Constructors Constructor Description ElementMappingRegistry(FopFactory factory)
Main constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElementMapping(java.lang.String mappingClassName)
Add the element mapping with the given class name.void
addElementMapping(ElementMapping mapping)
Add the element mapping.ElementMapping.Maker
findFOMaker(java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Locator locator)
Finds the Maker used to create node objects of a particular typeorg.w3c.dom.DOMImplementation
getDOMImplementationForNamespace(java.lang.String namespaceURI)
Tries to determine the DOMImplementation that is used to handled a particular namespace.ElementMapping
getElementMapping(java.lang.String namespaceURI)
Returns an ElementMapping class for a namespace URI if there is one.boolean
isKnownNamespace(java.lang.String namespaceURI)
Indicates whether a namespace is known to FOP.private void
setupDefaultMappings()
Sets all the element and property list mappings to their default values.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
logging instance
-
fobjTable
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,ElementMapping.Maker>> fobjTable
Table mapping element names to the makers of objects representing formatting objects.
-
namespaces
protected java.util.Map<java.lang.String,ElementMapping> namespaces
Map of mapped namespaces and their associated ElementMapping instances.
-
-
Constructor Detail
-
ElementMappingRegistry
public ElementMappingRegistry(FopFactory factory)
Main constructor. Adds all default element mapping as well as detects ElementMapping through the Service discovery.- Parameters:
factory
- the Fop Factory
-
-
Method Detail
-
setupDefaultMappings
private void setupDefaultMappings()
Sets all the element and property list mappings to their default values.
-
addElementMapping
public void addElementMapping(java.lang.String mappingClassName) throws java.lang.IllegalArgumentException
Add the element mapping with the given class name.- Parameters:
mappingClassName
- the class name representing the element mapping.- Throws:
java.lang.IllegalArgumentException
- if there was not such element mapping.
-
addElementMapping
public void addElementMapping(ElementMapping mapping)
Add the element mapping.- Parameters:
mapping
- the element mapping instance
-
findFOMaker
public ElementMapping.Maker findFOMaker(java.lang.String namespaceURI, java.lang.String localName, org.xml.sax.Locator locator) throws FOPException
Finds the Maker used to create node objects of a particular type- Parameters:
namespaceURI
- URI for the namespace of the elementlocalName
- name of the Elementlocator
- the Locator instance for context information- Returns:
- the ElementMapping.Maker that can create an FO object for this element
- Throws:
FOPException
- if a Maker could not be found for a bound namespace.
-
getDOMImplementationForNamespace
public org.w3c.dom.DOMImplementation getDOMImplementationForNamespace(java.lang.String namespaceURI)
Tries to determine the DOMImplementation that is used to handled a particular namespace. The method may return null for namespaces that don't result in a DOM. It is mostly used in namespaces occurring in foreign objects.- Parameters:
namespaceURI
- the namespace URI- Returns:
- the handling DOMImplementation, or null if not applicable
-
getElementMapping
public ElementMapping getElementMapping(java.lang.String namespaceURI)
Returns an ElementMapping class for a namespace URI if there is one.- Parameters:
namespaceURI
- the namespace URI- Returns:
- the requested ElementMapping or null, if no ElementMapping for the namespace is available.
-
isKnownNamespace
public boolean isKnownNamespace(java.lang.String namespaceURI)
Indicates whether a namespace is known to FOP.- Parameters:
namespaceURI
- the namespace URI- Returns:
- true if the namespace is known.
-
-