org.inria.ns.reflex.xml.provider.fo
Class PageSerializer

java.lang.Object
  extended by org.inria.ns.reflex.structures.Configurable.Impl
      extended by org.inria.ns.reflex.xml.serialize.SwitchSerializer
          extended by org.inria.ns.reflex.xml.provider.fo.PageSerializer
All Implemented Interfaces:
Configurable, Serializer

public class PageSerializer
extends SwitchSerializer

A page serializer for PDF-like output formats (PDF, PS, etc) that relies on FOP for XSLFO-like inputs (XSLFO, HTML+CSS, XML+CSS) or on Batik for SVG. This switch selects the right serializer according to the root element encountered. This default implementation dispatches to FOP or Batik serializers. To change this implementation, override the property "org.inria.ns.reflex.xml.serialize.SerializerFactory" as mentionned in Discover with your own class.

Author:
Philippe Poulard
See Also:
FOPSerializer, BatikSerializer, Discover

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Configurable
Configurable.Impl
 
Constructor Summary
PageSerializer(String mimeType)
          Create a default switch.
 
Method Summary
 boolean acceptAttribute(QName name)
          Accept only FOP and Batik attributes.
 void plugSerializer(URIResolver uriResolver, Source xmlSource, StreamResult xmlResult, SAXBuffer buffer, OutputStream[] out, String uri)
          Plug the buffer to FOP or Batik according to the namespace URI of the root element.
 
Methods inherited from class org.inria.ns.reflex.xml.serialize.SwitchSerializer
getMimeType, serialize
 
Methods inherited from class org.inria.ns.reflex.structures.Configurable.Impl
containsAttribute, getAttribute, getAttributes, mergeAttributes, setAttribute, setAttributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.structures.Configurable
containsAttribute, getAttribute, getAttributes, mergeAttributes, setAttribute, setAttributes
 

Constructor Detail

PageSerializer

public PageSerializer(String mimeType)
Create a default switch.

Parameters:
mimeType - The MIME type of the output.
Method Detail

acceptAttribute

public boolean acceptAttribute(QName name)
Accept only FOP and Batik attributes.

Parameters:
name - The name of the attribute.
Returns:
true if the attribute can be used to configure this serializer, false otherwise.
See Also:
FOPSerializer.XMLNS_FOP, BatikSerializer.XMLNS_BATIK

plugSerializer

public void plugSerializer(URIResolver uriResolver,
                           Source xmlSource,
                           StreamResult xmlResult,
                           SAXBuffer buffer,
                           OutputStream[] out,
                           String uri)
                    throws SAXException
Plug the buffer to FOP or Batik according to the namespace URI of the root element.

Specified by:
plugSerializer in class SwitchSerializer
Parameters:
uriResolver - The URI resolver to use by the serializer to resolve references found in the source to serialize.
xmlSource - The XML source from which SAX events are fired (and so far that have been bufferized)
xmlResult - The stream where the serializer have to write.
buffer - The SAX events that have been bufferized so far.
out - An array that contains a single output to write to; if this method use intermediate pipelines, it may change out[0] with the new output stream in order to don't break pipes.
uri - The namespace URI of the root element.
Throws:
SAXException