Package org.apache.sling.rewriter.impl.components

## Class AbstractTraxSerializerFactory

- java.lang.Object
- - org.apache.sling.rewriter.impl.components.AbstractTraxSerializerFactory

All Implemented Interfaces:
  `SerializerFactory`

Direct Known Subclasses:
  `TraxHtmlSerializerFactory`, `TraxXHtmlSerializerFactory`

    public abstract class AbstractTraxSerializerFactory
    extends Object
    implements SerializerFactory

Base class for trax based serializers.

### Nested Class Summary

Nested Classes
`static class` `AbstractTraxSerializerFactory.NamespaceAsAttributes` A pipe that ensures that all namespace prefixes are also present as 'xmlns:' attributes.

### Constructor Summary

Constructors
`AbstractTraxSerializerFactory()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`protected void` `activate​(org.osgi.service.component.ComponentContext ctx)`
`Serializer` `createSerializer()` Create a new serializer for the pipeline.
`protected void` `deactivat​(org.osgi.service.component.ComponentContext ctx)`
`protected abstract String` `getDoctypePublic()`
`protected abstract String` `getDoctypeSystem()`
`protected abstract String` `getOutputFormat()`
`protected boolean` `needsNamespacesAsAttributes()` Checks if the used Trax implementation correctly handles namespaces set using `startPrefixMapping()`, but wants them also as 'xmlns:' attributes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractTraxSerializerFactory

    public AbstractTraxSerializerFactory()

### Method Detail

#### getOutputFormat

    protected abstract String getOutputFormat()

#### getDoctypePublic

    protected abstract String getDoctypePublic()

#### getDoctypeSystem

    protected abstract String getDoctypeSystem()

#### createSerializer

    public Serializer createSerializer()

Description copied from interface: `SerializerFactory`
Create a new serializer for the pipeline.

Specified by:
  `createSerializer` in interface `SerializerFactory`
Returns:
  A new serializer.
See Also:
  `SerializerFactory.createSerializer()`

#### activate

    protected void activate​(org.osgi.service.component.ComponentContext ctx)

#### deactivat

    protected void deactivat​(org.osgi.service.component.ComponentContext ctx)

#### needsNamespacesAsAttributes

    protected boolean needsNamespacesAsAttributes()
                                           throws Exception

Checks if the used Trax implementation correctly handles namespaces set using `startPrefixMapping()`, but wants them also as 'xmlns:' attributes.

The check consists in sending SAX events representing a minimal namespaced document with namespaces defined only with calls to `startPrefixMapping` (no xmlns:xxx attributes) and check if they are present in the resulting text.

Returns:
  if the support is given
Throws:
  `Exception` - in case of any exception during the check