FromXmlParser and ToXmlGenerator
instances.
Implements TokenStreamFactory since interface for constructing XML backed
parsers and generators is quite similar to dealing with JSON.
| Modifier and Type | Field and Description |
|---|---|
| protected final String | |
| protected transient String | |
| protected transient String | |
| protected final XmlNameProcessor | |
| protected final transient XMLInputFactory | |
| protected final transient XMLOutputFactory | |
| protected static final int | DEFAULT_XML_READ_FEATURE_FLAGS
Bitfield (set of flags) of all parser features that are enabled by default. |
| protected static final int | DEFAULT_XML_WRITE_FEATURE_FLAGS
Bitfield (set of flags) of all generator features that are enabled by default. |
| public static final String | FORMAT_NAME_XML
Name used to identify XML format
(and returned by |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| protected | XmlFactory(int xpFeatures, int xgFeatures, XMLInputFactory xmlIn, XMLOutputFactory xmlOut, XmlNameProcessor nameProcessor, String nameForTextElem)
|
| protected | |
| protected | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected JsonGenerator | _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, Writer out)
Implements abstract tools. Overridable factory method that actually instantiates generator for
given |
| protected JsonParser | _createParser(ObjectReadContext readCtxt, IOContext ctxt, DataInput input)
Implements abstract tools.
|
| protected FromXmlParser | _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in)
Implements abstract tools.
|
| protected FromXmlParser | _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, Reader r)
Implements abstract tools.
|
| protected FromXmlParser | _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recycleBuffer)
Implements abstract tools.
|
| protected FromXmlParser | _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len)
Implements abstract tools.
|
| protected JsonGenerator | _createUTF8Generator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out)
Implements abstract tools. Overridable factory method that actually instantiates generator for
given |
| protected XMLStreamWriter | |
| protected XMLStreamWriter | |
| protected FromXmlParser | _fromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, XMLStreamReader sr)
Overridable method to allow using custom FromXmlParser sub-classes. |
| protected void | |
| protected final XMLStreamReader | |
| protected final XMLStreamWriter | |
| protected ToXmlGenerator | _toXmlGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, XMLStreamWriter sw)
Overridable method to allow using custom FromXmlParser sub-classes. |
| private final XmlPrettyPrinter | |
| public static XmlFactoryBuilder | builder()
Main factory method to use for constructing |
| public static XmlFactoryBuilder | builderWithJackson2Defaults()
The builder returned uses default settings more closely matching the default configs used in Jackson 2.x versions. |
| public boolean | canParseAsync()
Implements abstract tools. Introspection method that can be used to check whether this
factory can create non-blocking parsers: parsers that do not
use blocking I/O abstractions but instead use a
|
| public boolean | canUseCharArrays()
Overrides tools. Since 2.4, we do have actual capability for passing char arrays efficiently, but unfortunately have no working mechanism for recycling buffers. |
| public boolean | canUseSchema(FormatSchema schema)
Implements abstract tools. Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use. |
| public XmlFactory | copy()
Implements abstract tools. Note compared to base implementation by |
| public ToXmlGenerator | createGenerator(ObjectWriteContext writeCtxt, XMLStreamWriter sw)
Factory method that wraps given |
| public JsonParser | createParser(ObjectReadContext readCtxt, String content)
Overrides tools. Overridden just to prevent trying to optimize access via char array; while nice idea, problem is that we don't have proper hooks to ensure that temporary buffer gets recycled; so let's just use StringReader. |
| public FromXmlParser | createParser(ObjectReadContext readCtxt, XMLStreamReader sr)
Factory method that wraps given |
| public String | getFormatName()
Implements abstract tools. Method that returns short textual id identifying format this factory supports. |
| public int | |
| public Class | getFormatReadFeatureType()
Overrides tools. Method for accessing kind of |
| public int | |
| public Class | getFormatWriteFeatureType()
Overrides tools. Method for accessing kind of |
| public XMLInputFactory | |
| public XMLOutputFactory | |
| public String | |
| private void | readObject(ObjectInputStream in)
In addition to default serialization, which mostly works, need to handle case of XML factories, hence override. |
| protected Object | readResolve()
Method that we need to override to actually make restoration go through constructors etc. |
| public XmlFactoryBuilder | rebuild()
Implements abstract tools. Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory. |
| public TokenStreamFactory | snapshot()
Implements abstract tools. Implements tools. Instances are immutable so just return `this` |
| public Version | version()
Implements abstract tools. Implements tools. Method called to detect version of the component that implements this interface;
returned version should never be null, but may return specific "not available"
instance (see |
| public XmlFactory | withNameForTextElement(String name)
"Mutant factory" method used to allow |
| private void | writeObject(ObjectOutputStream out)
In addition to default serialization, which mostly works, need to handle case of XML factories, hence override. |
| _cfgNameForTextElement | back to summary |
|---|---|
| protected final String _cfgNameForTextElement | |
| _jdkXmlInFactory | back to summary |
|---|---|
| protected transient String _jdkXmlInFactory | |
| _jdkXmlOutFactory | back to summary |
|---|---|
| protected transient String _jdkXmlOutFactory | |
| _nameProcessor | back to summary |
|---|---|
| protected final XmlNameProcessor _nameProcessor | |
| _xmlInputFactory | back to summary |
|---|---|
| protected final transient XMLInputFactory _xmlInputFactory | |
| _xmlOutputFactory | back to summary |
|---|---|
| protected final transient XMLOutputFactory _xmlOutputFactory | |
| DEFAULT_XML_READ_FEATURE_FLAGS | back to summary |
|---|---|
| protected static final int DEFAULT_XML_READ_FEATURE_FLAGS Bitfield (set of flags) of all parser features that are enabled by default. | |
| DEFAULT_XML_WRITE_FEATURE_FLAGS | back to summary |
|---|---|
| protected static final int DEFAULT_XML_WRITE_FEATURE_FLAGS Bitfield (set of flags) of all generator features that are enabled by default. | |
| FORMAT_NAME_XML | back to summary |
|---|---|
| public static final String FORMAT_NAME_XML Name used to identify XML format
(and returned by | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides tools. | |
| XmlFactory | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| public XmlFactory(XMLInputFactory xmlIn) | |
| XmlFactory | back to summary |
|---|---|
| public XmlFactory(XMLInputFactory xmlIn, XMLOutputFactory xmlOut) | |
| XmlFactory | back to summary |
|---|---|
| protected XmlFactory(int xpFeatures, int xgFeatures, XMLInputFactory xmlIn, XMLOutputFactory xmlOut, XmlNameProcessor nameProcessor, String nameForTextElem) | |
| XmlFactory | back to summary |
|---|---|
| protected XmlFactory(XmlFactoryBuilder b) Constructor used by | |
| XmlFactory | back to summary |
|---|---|
| protected XmlFactory(XmlFactory src) Constructor used by
| |
| XmlFactory | back to summary |
|---|---|
| protected XmlFactory(XmlFactory src, String nameForTextElement) | |
| _createGenerator | back to summary |
|---|---|
| protected JsonGenerator _createGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, Writer out) Implements abstract tools. Doc from tools. Overridable factory method that actually instantiates generator for
given This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.
| |
| _createParser | back to summary |
|---|---|
| protected JsonParser _createParser(ObjectReadContext readCtxt, IOContext ctxt, DataInput input) Implements abstract tools.
| |
| _createParser | back to summary |
|---|---|
| protected FromXmlParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, InputStream in) Implements abstract tools.
| |
| _createParser | back to summary |
|---|---|
| protected FromXmlParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, Reader r) Implements abstract tools.
| |
| _createParser | back to summary |
|---|---|
| protected FromXmlParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, char[] data, int offset, int len, boolean recycleBuffer) Implements abstract tools.
| |
| _createParser | back to summary |
|---|---|
| protected FromXmlParser _createParser(ObjectReadContext readCtxt, IOContext ioCtxt, byte[] data, int offset, int len) Implements abstract tools.
| |
| _createUTF8Generator | back to summary |
|---|---|
| protected JsonGenerator _createUTF8Generator(ObjectWriteContext writeCtxt, IOContext ioCtxt, OutputStream out) Implements abstract tools. Doc from tools. Overridable factory method that actually instantiates generator for
given This method is specifically designed to remain compatible between minor versions so that sub-classes can count on it being called as expected. That is, it is part of official interface from sub-class perspective, although not a public method available to users of factory implementations.
| |
| _createXmlWriter | back to summary |
|---|---|
| protected XMLStreamWriter _createXmlWriter(OutputStream out) | |
| _createXmlWriter | back to summary |
|---|---|
| protected XMLStreamWriter _createXmlWriter(Writer w) | |
| _fromXmlParser | back to summary |
|---|---|
| protected FromXmlParser _fromXmlParser(ObjectReadContext readCtxt, IOContext ioCtxt, XMLStreamReader sr) Overridable method to allow using custom FromXmlParser sub-classes. | |
| _initFactories | back to summary |
|---|---|
| protected void _initFactories(XMLInputFactory xmlIn, XMLOutputFactory xmlOut) | |
| _initializeXmlReader | back to summary |
|---|---|
| protected final XMLStreamReader _initializeXmlReader(XMLStreamReader sr) | |
| _initializeXmlWriter | back to summary |
|---|---|
| protected final XMLStreamWriter _initializeXmlWriter(XMLStreamWriter sw) | |
| _toXmlGenerator | back to summary |
|---|---|
| protected ToXmlGenerator _toXmlGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt, XMLStreamWriter sw) Overridable method to allow using custom FromXmlParser sub-classes. | |
| _xmlPrettyPrinter | back to summary |
|---|---|
| private final XmlPrettyPrinter _xmlPrettyPrinter(ObjectWriteContext writeCtxt) | |
| builder | back to summary |
|---|---|
| public static XmlFactoryBuilder builder() Main factory method to use for constructing | |
| builderWithJackson2Defaults | back to summary |
|---|---|
| public static XmlFactoryBuilder builderWithJackson2Defaults() The builder returned uses default settings more closely matching the default configs used in Jackson 2.x versions. This method is still a work in progress and may not yet fully replicate the default settings of Jackson 2.x. | |
| canParseAsync | back to summary |
|---|---|
| public boolean canParseAsync() Implements abstract tools. Doc from tools. Introspection method that can be used to check whether this
factory can create non-blocking parsers: parsers that do not
use blocking I/O abstractions but instead use a
| |
| canUseCharArrays | back to summary |
|---|---|
| public boolean canUseCharArrays() Overrides tools. Since 2.4, we do have actual capability for passing char arrays efficiently, but unfortunately have no working mechanism for recycling buffers. So we have to admit that can not make efficient use.
| |
| canUseSchema | back to summary |
|---|---|
| public boolean canUseSchema(FormatSchema schema) Implements abstract tools. Doc from tools. Method that can be used to quickly check whether given schema is something that parsers and/or generators constructed by this factory could use. Note that this means possible use, at the level of data format (i.e. schema is for same data format as parsers and generators this factory constructs); individual schema instances may have further usage restrictions.
| |
| copy | back to summary |
|---|---|
| public XmlFactory copy() Implements abstract tools. Note compared to base implementation by
| |
| createGenerator | back to summary |
|---|---|
| public ToXmlGenerator createGenerator(ObjectWriteContext writeCtxt, XMLStreamWriter sw) throws IOException Factory method that wraps given | |
| createParser | back to summary |
|---|---|
| public JsonParser createParser(ObjectReadContext readCtxt, String content) Overrides tools. Overridden just to prevent trying to optimize access via char array; while nice idea, problem is that we don't have proper hooks to ensure that temporary buffer gets recycled; so let's just use StringReader.
| |
| createParser | back to summary |
|---|---|
| public FromXmlParser createParser(ObjectReadContext readCtxt, XMLStreamReader sr) throws IOException Factory method that wraps given | |
| getFormatName | back to summary |
|---|---|
| public String getFormatName() Implements abstract tools. Method that returns short textual id identifying format this factory supports. Note sub-classes should override this method; default implementation will return null for all sub-classes
| |
| getFormatReadFeatures | back to summary |
|---|---|
| public int getFormatReadFeatures() Overrides tools.
| |
| getFormatReadFeatureType | back to summary |
|---|---|
| public Class Overrides tools. Doc from tools. Method for accessing kind of
| |
| getFormatWriteFeatures | back to summary |
|---|---|
| public int getFormatWriteFeatures() Overrides tools.
| |
| getFormatWriteFeatureType | back to summary |
|---|---|
| public Class Overrides tools. Doc from tools. Method for accessing kind of
| |
| getXMLInputFactory | back to summary |
|---|---|
| public XMLInputFactory getXMLInputFactory() | |
| getXMLOutputFactory | back to summary |
|---|---|
| public XMLOutputFactory getXMLOutputFactory() | |
| getXMLTextElementName | back to summary |
|---|---|
| public String getXMLTextElementName() | |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException In addition to default serialization, which mostly works, need to handle case of XML factories, hence override. | |
| readResolve | back to summary |
|---|---|
| protected Object readResolve() Method that we need to override to actually make restoration go through constructors etc. | |
| rebuild | back to summary |
|---|---|
| public XmlFactoryBuilder rebuild() Implements abstract tools. Doc from tools. Method that can be used to create differently configured stream factories: it will create and return a Builder instance with exact settings of this stream factory.
| |
| snapshot | back to summary |
|---|---|
| public TokenStreamFactory snapshot() Implements abstract tools. Implements tools. Instances are immutable so just return `this`
| |
| version | back to summary |
|---|---|
| public Version version() Implements abstract tools. Implements tools. Doc from tools. Method called to detect version of the component that implements this interface;
returned version should never be null, but may return specific "not available"
instance (see
| |
| withNameForTextElement | back to summary |
|---|---|
| public XmlFactory withNameForTextElement(String name) "Mutant factory" method used to allow | |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream out) throws IOException In addition to default serialization, which mostly works, need to handle case of XML factories, hence override. | |