com.fasterxml.jackson.xml
Class XmlFactory

java.lang.Object
  extended by org.codehaus.jackson.JsonFactory
      extended by com.fasterxml.jackson.xml.XmlFactory
All Implemented Interfaces:
org.codehaus.jackson.Versioned

public class XmlFactory
extends org.codehaus.jackson.JsonFactory

Factory used for constructing FromXmlParser and ToXmlGenerator instances.

Implements JsonFactory since interface for constructing XML backed parsers and generators is quite similar to dealing with JSON.

Since:
1.6
Author:
tatu

Field Summary
protected  int _xmlGeneratorFeatures
           
protected  XMLInputFactory _xmlInputFactory
           
protected  XMLOutputFactory _xmlOutputFactory
           
protected  int _xmlParserFeatures
           
 
Fields inherited from class org.codehaus.jackson.JsonFactory
_generatorFeatures, _objectCodec, _parserFeatures, _recyclerRef, _rootByteSymbols, _rootCharSymbols
 
Constructor Summary
XmlFactory()
          Default constructor used to create factory instances.
XmlFactory(org.codehaus.jackson.ObjectCodec oc)
           
XmlFactory(org.codehaus.jackson.ObjectCodec oc, XMLInputFactory xmlIn, XMLOutputFactory xmlOut)
           
XmlFactory(XMLInputFactory xmlIn, XMLOutputFactory xmlOut)
           
 
Method Summary
protected  FromXmlParser _createJsonParser(byte[] data, int offset, int len, org.codehaus.jackson.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  FromXmlParser _createJsonParser(InputStream in, org.codehaus.jackson.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  FromXmlParser _createJsonParser(Reader r, org.codehaus.jackson.io.IOContext ctxt)
          Overridable factory method that actually instantiates desired parser.
protected  XMLStreamWriter _createXmlWriter(OutputStream out)
           
protected  XMLStreamWriter _createXmlWriter(Writer w)
           
protected  XMLStreamReader _initializeXmlReader(XMLStreamReader sr)
           
protected  XMLStreamWriter _initializeXmlWriter(XMLStreamWriter sw)
           
 XmlFactory configure(FromXmlParser.Feature f, boolean state)
          Method for enabling or disabling specified XML parser feature.
 XmlFactory configure(ToXmlGenerator.Feature f, boolean state)
          Method for enabling or disabling specified XML generator feature.
 ToXmlGenerator createJsonGenerator(File f, org.codehaus.jackson.JsonEncoding enc)
           
 ToXmlGenerator createJsonGenerator(OutputStream out, org.codehaus.jackson.JsonEncoding enc)
           note: co-variant return type
 ToXmlGenerator createJsonGenerator(Writer out)
           
 XmlFactory disable(FromXmlParser.Feature f)
          Method for disabling specified XML parser feature.
 XmlFactory disable(ToXmlGenerator.Feature f)
          Method for disabling specified XML generator feature.
 XmlFactory enable(FromXmlParser.Feature f)
          Method for enabling specified XML parser feature.
 XmlFactory enable(ToXmlGenerator.Feature f)
          Method for enabling specified XML generator feature.
 boolean isEnabled(FromXmlParser.Feature f)
          Checked whether specified XML parser feature is enabled.
 boolean isEnabled(ToXmlGenerator.Feature f)
          Check whether specified XML generator feature is enabled.
 void setXMLInputFactory(XMLInputFactory f)
           
 void setXMLOutputFactory(XMLOutputFactory f)
           
 
Methods inherited from class org.codehaus.jackson.JsonFactory
_createContext, _createJsonGenerator, _createUTF8JsonGenerator, _createWriter, _getBufferRecycler, _optimizedStreamFromURL, configure, configure, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, disable, disable, disableGeneratorFeature, disableParserFeature, enable, enable, enableGeneratorFeature, enableParserFeature, getCodec, isEnabled, isEnabled, isGeneratorFeatureEnabled, isParserFeatureEnabled, setCodec, setGeneratorFeature, setParserFeature, version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_xmlParserFeatures

protected int _xmlParserFeatures

_xmlGeneratorFeatures

protected int _xmlGeneratorFeatures

_xmlInputFactory

protected XMLInputFactory _xmlInputFactory

_xmlOutputFactory

protected XMLOutputFactory _xmlOutputFactory
Constructor Detail

XmlFactory

public XmlFactory()
Default constructor used to create factory instances. Creation of a factory instance is a light-weight operation, but it is still a good idea to reuse limited number of factory instances (and quite often just a single instance): factories are used as context for storing some reused processing objects (such as symbol tables parsers use) and this reuse only works within context of a single factory instance.


XmlFactory

public XmlFactory(org.codehaus.jackson.ObjectCodec oc)

XmlFactory

public XmlFactory(XMLInputFactory xmlIn,
                  XMLOutputFactory xmlOut)

XmlFactory

public XmlFactory(org.codehaus.jackson.ObjectCodec oc,
                  XMLInputFactory xmlIn,
                  XMLOutputFactory xmlOut)
Method Detail

configure

public final XmlFactory configure(FromXmlParser.Feature f,
                                  boolean state)
Method for enabling or disabling specified XML parser feature.


enable

public XmlFactory enable(FromXmlParser.Feature f)
Method for enabling specified XML parser feature.


disable

public XmlFactory disable(FromXmlParser.Feature f)
Method for disabling specified XML parser feature.


isEnabled

public final boolean isEnabled(FromXmlParser.Feature f)
Checked whether specified XML parser feature is enabled.


configure

public final XmlFactory configure(ToXmlGenerator.Feature f,
                                  boolean state)
Method for enabling or disabling specified XML generator feature.


enable

public XmlFactory enable(ToXmlGenerator.Feature f)
Method for enabling specified XML generator feature.


disable

public XmlFactory disable(ToXmlGenerator.Feature f)
Method for disabling specified XML generator feature.


isEnabled

public final boolean isEnabled(ToXmlGenerator.Feature f)
Check whether specified XML generator feature is enabled.


setXMLInputFactory

public void setXMLInputFactory(XMLInputFactory f)

setXMLOutputFactory

public void setXMLOutputFactory(XMLOutputFactory f)

createJsonGenerator

public ToXmlGenerator createJsonGenerator(OutputStream out,
                                          org.codehaus.jackson.JsonEncoding enc)
                                   throws IOException

note: co-variant return type

Overrides:
createJsonGenerator in class org.codehaus.jackson.JsonFactory
Throws:
IOException

createJsonGenerator

public ToXmlGenerator createJsonGenerator(Writer out)
                                   throws IOException
Overrides:
createJsonGenerator in class org.codehaus.jackson.JsonFactory
Throws:
IOException

createJsonGenerator

public ToXmlGenerator createJsonGenerator(File f,
                                          org.codehaus.jackson.JsonEncoding enc)
                                   throws IOException
Overrides:
createJsonGenerator in class org.codehaus.jackson.JsonFactory
Throws:
IOException

_createJsonParser

protected FromXmlParser _createJsonParser(InputStream in,
                                          org.codehaus.jackson.io.IOContext ctxt)
                                   throws IOException,
                                          org.codehaus.jackson.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class org.codehaus.jackson.JsonFactory
Throws:
IOException
org.codehaus.jackson.JsonParseException

_createJsonParser

protected FromXmlParser _createJsonParser(Reader r,
                                          org.codehaus.jackson.io.IOContext ctxt)
                                   throws IOException,
                                          org.codehaus.jackson.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class org.codehaus.jackson.JsonFactory
Throws:
IOException
org.codehaus.jackson.JsonParseException

_createJsonParser

protected FromXmlParser _createJsonParser(byte[] data,
                                          int offset,
                                          int len,
                                          org.codehaus.jackson.io.IOContext ctxt)
                                   throws IOException,
                                          org.codehaus.jackson.JsonParseException
Overridable factory method that actually instantiates desired parser.

Overrides:
_createJsonParser in class org.codehaus.jackson.JsonFactory
Throws:
IOException
org.codehaus.jackson.JsonParseException

_createXmlWriter

protected XMLStreamWriter _createXmlWriter(OutputStream out)
                                    throws IOException
Throws:
IOException

_createXmlWriter

protected XMLStreamWriter _createXmlWriter(Writer w)
                                    throws IOException
Throws:
IOException

_initializeXmlWriter

protected final XMLStreamWriter _initializeXmlWriter(XMLStreamWriter sw)
                                              throws IOException,
                                                     XMLStreamException
Throws:
IOException
XMLStreamException

_initializeXmlReader

protected final XMLStreamReader _initializeXmlReader(XMLStreamReader sr)
                                              throws IOException,
                                                     XMLStreamException
Throws:
IOException
XMLStreamException


Copyright © 2011 fasterxml.com. All Rights Reserved.