public class XmlFactory
extends com.fasterxml.jackson.core.JsonFactory
FromXmlParser
and ToXmlGenerator
instances.
Implements JsonFactory
since interface for constructing XML backed
parsers and generators is quite similar to dealing with JSON.
Modifier and Type | Field and Description |
---|---|
protected String |
_cfgNameForTextElement |
protected String |
_jdkXmlInFactory
Hiding place for JDK-serialization unthawed factories...
|
protected String |
_jdkXmlOutFactory
Hiding place for JDK-serialization unthawed factories...
|
protected int |
_xmlGeneratorFeatures |
protected XMLInputFactory |
_xmlInputFactory |
protected XMLOutputFactory |
_xmlOutputFactory |
protected int |
_xmlParserFeatures |
static String |
FORMAT_NAME_XML
Name used to identify XML format
(and returned by
getFormatName() |
_characterEscapes, _factoryFeatures, _generatorFeatures, _inputDecorator, _objectCodec, _outputDecorator, _parserFeatures, _recyclerRef, _rootByteSymbols, _rootCharSymbols, _rootValueSeparator, DEFAULT_FACTORY_FEATURE_FLAGS, DEFAULT_GENERATOR_FEATURE_FLAGS, DEFAULT_PARSER_FEATURE_FLAGS, FORMAT_NAME_JSON
Modifier | Constructor and Description |
---|---|
|
XmlFactory()
Default constructor used to create factory instances.
|
|
XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc) |
protected |
XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc,
int xpFeatures,
int xgFeatures,
XMLInputFactory xmlIn,
XMLOutputFactory xmlOut,
String nameForTextElem) |
|
XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc,
XMLInputFactory xmlIn,
XMLOutputFactory xmlOut) |
protected |
XmlFactory(XmlFactory src,
com.fasterxml.jackson.core.ObjectCodec oc) |
|
XmlFactory(XMLInputFactory xmlIn,
XMLOutputFactory xmlOut) |
Modifier and Type | Method and Description |
---|---|
protected FromXmlParser |
_createJsonParser(byte[] data,
int offset,
int len,
com.fasterxml.jackson.core.io.IOContext ctxt)
Deprecated.
|
protected FromXmlParser |
_createJsonParser(InputStream in,
com.fasterxml.jackson.core.io.IOContext ctxt)
Deprecated.
|
protected FromXmlParser |
_createJsonParser(Reader r,
com.fasterxml.jackson.core.io.IOContext ctxt)
Deprecated.
|
protected FromXmlParser |
_createParser(byte[] data,
int offset,
int len,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected FromXmlParser |
_createParser(InputStream in,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected FromXmlParser |
_createParser(Reader r,
com.fasterxml.jackson.core.io.IOContext ctxt) |
protected XMLStreamWriter |
_createXmlWriter(OutputStream out) |
protected XMLStreamWriter |
_createXmlWriter(Writer w) |
protected void |
_initFactories(XMLInputFactory xmlIn,
XMLOutputFactory xmlOut) |
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.
|
XmlFactory |
copy()
Note: compared to base implementation by
JsonFactory ,
here the copy will actually share underlying XML input and
output factories, as there is no way to make copies of those. |
ToXmlGenerator |
createGenerator(File f,
com.fasterxml.jackson.core.JsonEncoding enc) |
ToXmlGenerator |
createGenerator(OutputStream out) |
ToXmlGenerator |
createGenerator(OutputStream out,
com.fasterxml.jackson.core.JsonEncoding enc) |
ToXmlGenerator |
createGenerator(Writer out) |
ToXmlGenerator |
createJsonGenerator(File f,
com.fasterxml.jackson.core.JsonEncoding enc)
Deprecated.
|
ToXmlGenerator |
createJsonGenerator(OutputStream out,
com.fasterxml.jackson.core.JsonEncoding enc)
Deprecated.
|
ToXmlGenerator |
createJsonGenerator(Writer out)
Deprecated.
|
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.
|
String |
getFormatName()
Method that returns short textual id identifying format
this factory supports.
|
String |
getXMLTextElementName() |
com.fasterxml.jackson.core.format.MatchStrength |
hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) |
static com.fasterxml.jackson.core.format.MatchStrength |
hasXMLFormat(com.fasterxml.jackson.core.format.InputAccessor acc)
Method that tries to figure out if content seems to be in some kind
of XML format.
|
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.
|
protected Object |
readResolve()
Method that we need to override to actually make restoration go
through constructors etc.
|
boolean |
requiresCustomCodec()
XML format does require support from custom
ObjectCodec
(that is, XmlMapper ), so need to return true here. |
void |
setXMLInputFactory(XMLInputFactory f) |
void |
setXMLOutputFactory(XMLOutputFactory f) |
void |
setXMLTextElementName(String name) |
com.fasterxml.jackson.core.Version |
version() |
_checkInvalidCopy, _createContext, _createGenerator, _createJsonGenerator, _createUTF8Generator, _createUTF8JsonGenerator, _createWriter, _getBufferRecycler, _optimizedStreamFromURL, canHandleBinaryNatively, canUseSchema, configure, configure, configure, createJsonGenerator, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createJsonParser, createParser, createParser, createParser, createParser, createParser, createParser, createParser, disable, disable, disable, enable, enable, enable, getCharacterEscapes, getCodec, getInputDecorator, getOutputDecorator, getRootValueSeparator, hasJSONFormat, isEnabled, isEnabled, isEnabled, requiresPropertyOrdering, setCharacterEscapes, setCodec, setInputDecorator, setOutputDecorator, setRootValueSeparator
public static final String FORMAT_NAME_XML
getFormatName()
protected int _xmlParserFeatures
protected int _xmlGeneratorFeatures
protected transient XMLInputFactory _xmlInputFactory
protected transient XMLOutputFactory _xmlOutputFactory
protected String _cfgNameForTextElement
protected transient String _jdkXmlInFactory
protected transient String _jdkXmlOutFactory
public XmlFactory()
public XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc)
public XmlFactory(XMLInputFactory xmlIn, XMLOutputFactory xmlOut)
public XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc, XMLInputFactory xmlIn, XMLOutputFactory xmlOut)
protected XmlFactory(com.fasterxml.jackson.core.ObjectCodec oc, int xpFeatures, int xgFeatures, XMLInputFactory xmlIn, XMLOutputFactory xmlOut, String nameForTextElem)
protected XmlFactory(XmlFactory src, com.fasterxml.jackson.core.ObjectCodec oc)
protected void _initFactories(XMLInputFactory xmlIn, XMLOutputFactory xmlOut)
public XmlFactory copy()
JsonFactory
,
here the copy will actually share underlying XML input and
output factories, as there is no way to make copies of those.copy
in class com.fasterxml.jackson.core.JsonFactory
public com.fasterxml.jackson.core.Version version()
version
in interface com.fasterxml.jackson.core.Versioned
version
in class com.fasterxml.jackson.core.JsonFactory
protected Object readResolve()
readResolve
in class com.fasterxml.jackson.core.JsonFactory
public void setXMLTextElementName(String name)
public String getXMLTextElementName()
public final XmlFactory configure(FromXmlParser.Feature f, boolean state)
public XmlFactory enable(FromXmlParser.Feature f)
public XmlFactory disable(FromXmlParser.Feature f)
public final boolean isEnabled(FromXmlParser.Feature f)
public final XmlFactory configure(ToXmlGenerator.Feature f, boolean state)
public XmlFactory enable(ToXmlGenerator.Feature f)
public XmlFactory disable(ToXmlGenerator.Feature f)
public final boolean isEnabled(ToXmlGenerator.Feature f)
public void setXMLInputFactory(XMLInputFactory f)
public void setXMLOutputFactory(XMLOutputFactory f)
public String getFormatName()
Note: sub-classes should override this method; default implementation will return null for all sub-classes
getFormatName
in class com.fasterxml.jackson.core.JsonFactory
public com.fasterxml.jackson.core.format.MatchStrength hasFormat(com.fasterxml.jackson.core.format.InputAccessor acc) throws IOException
hasFormat
in class com.fasterxml.jackson.core.JsonFactory
IOException
public boolean requiresCustomCodec()
ObjectCodec
(that is, XmlMapper
), so need to return true here.requiresCustomCodec
in class com.fasterxml.jackson.core.JsonFactory
public ToXmlGenerator createGenerator(OutputStream out) throws IOException
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
public ToXmlGenerator createGenerator(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) throws IOException
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
public ToXmlGenerator createGenerator(Writer out) throws IOException
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
public ToXmlGenerator createGenerator(File f, com.fasterxml.jackson.core.JsonEncoding enc) throws IOException
createGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
@Deprecated public ToXmlGenerator createJsonGenerator(OutputStream out, com.fasterxml.jackson.core.JsonEncoding enc) throws IOException
createJsonGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
@Deprecated public ToXmlGenerator createJsonGenerator(Writer out) throws IOException
createJsonGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
@Deprecated public ToXmlGenerator createJsonGenerator(File f, com.fasterxml.jackson.core.JsonEncoding enc) throws IOException
createJsonGenerator
in class com.fasterxml.jackson.core.JsonFactory
IOException
protected FromXmlParser _createParser(InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
protected FromXmlParser _createParser(Reader r, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
protected FromXmlParser _createParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
@Deprecated protected FromXmlParser _createJsonParser(InputStream in, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createJsonParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
@Deprecated protected FromXmlParser _createJsonParser(Reader r, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createJsonParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
@Deprecated protected FromXmlParser _createJsonParser(byte[] data, int offset, int len, com.fasterxml.jackson.core.io.IOContext ctxt) throws IOException, com.fasterxml.jackson.core.JsonParseException
_createJsonParser
in class com.fasterxml.jackson.core.JsonFactory
IOException
com.fasterxml.jackson.core.JsonParseException
protected XMLStreamWriter _createXmlWriter(OutputStream out) throws IOException
IOException
protected XMLStreamWriter _createXmlWriter(Writer w) throws IOException
IOException
protected final XMLStreamWriter _initializeXmlWriter(XMLStreamWriter sw) throws IOException, XMLStreamException
IOException
XMLStreamException
protected final XMLStreamReader _initializeXmlReader(XMLStreamReader sr) throws IOException, XMLStreamException
IOException
XMLStreamException
public static com.fasterxml.jackson.core.format.MatchStrength hasXMLFormat(com.fasterxml.jackson.core.format.InputAccessor acc) throws IOException
IOException
Copyright © 2012–2014 FasterXML. All rights reserved.