Deprecated
as a consequence of AbstractXmlWriter being deprecated. See corresponding docs for further information.
parser that acts as an XStream
com.thoughtworks.xstream.io.HierarchicalStreamWriter to enable direct generation of a
SAX event flow from the XStream serialization of a list of list of Java objects.
As a
custom SAX parser, this class ignores the arguments of the two standard parse methods (parse(java.
and parse(org.) but relies on a proprietary SAX property
SOURCE_OBJECT_LIST_PROPERTY to define the list of objects to serialize.
Configuration of this SAX parser is achieved through the standard
SAX property mechanism. While specific setter methods require direct
access to the parser instance, SAX properties support configuration settings to be propagated
through a chain of filters down to the underlying parser
object.
This mechanism shall be used to configure the
objects to be serialized as well as the
XStream facade.
| Modifier and Type | Field and Description |
|---|---|
| private final AttributesImpl | |
| private char[] | |
| public static final String | CONFIGURED_XSTREAM_PROPERTY
The |
| private ContentHandler | contentHandler
The SAX ContentHandler associated to this XMLReader. |
| private int | |
| private DTDHandler | dtdHandler
The SAX DTDHandler associated to this XMLReader. |
| private List | |
| private EntityResolver | entityResolver
The SAX EntityResolver associated to this XMLReader. |
| private ErrorHandler | errorHandler
The SAX ErrorHandler associated to this XMLReader. |
| private Map | features
The SAX features defined for this XMLReader. |
| private final boolean | |
| private final Map | properties
The SAX properties defined for this XMLReader. |
| public static final String | SOURCE_OBJECT_LIST_PROPERTY
The |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | SaxWriter(XmlFriendlyReplacer replacer)
Deprecated
As of 1.4 use
SaxWriter#SaxWriter(NameCoder) instead.
|
| public | SaxWriter(boolean includeEnclosingDocument, XmlFriendlyReplacer replacer)
Deprecated
As of 1.4 use
SaxWriter#SaxWriter(boolean, NameCoder) instead.
|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAttribute(String name, String value)
Implements com. |
| public void | close()
Implements com. |
| private void | endDocument(boolean
whether serialization of several
object will be merge into a single
SAX document. multiObjectMode)Fires the SAX endDocument event towards the configured ContentHandler. |
| public void | |
| public void | flush()
Implements com. |
| private void | |
| public ContentHandler | Returns: the current content handler, ornull if none
has been registered.Implements org. |
| public DTDHandler | Returns: the current DTD handler, ornull if none
has been registered.Implements org. |
| public EntityResolver | Returns: the current entity resolver, ornull if none
has been registered.Implements org. |
| public ErrorHandler | Returns: the current error handler, ornull if none
has been registered.Implements org. |
| public boolean | Returns: the current state of the feature (true or false).the feature name, which is a fully-qualified URI. name)Implements org. |
| public Object | Returns: the current value of the property.the property name, which is a fully-qualified URI. name)Implements org. |
| public void | parse(String
the system identifier (URI). systemId)Implements org. |
| public void | parse(InputSource
The input source for the top-level of the
XML document. input)Implements org. |
| private void | |
| public void | setContentHandler(ContentHandler
the content handler. handler)Implements org. |
| public void | setDTDHandler(DTDHandler
the DTD handler. handler)Implements org. |
| public void | setEntityResolver(EntityResolver
the entity resolver. resolver)Implements org. |
| public void | setErrorHandler(ErrorHandler
the error handler. handler)Implements org. |
| public void | setFeature(String
the feature name, which is a fully-qualified URI. name, boolean the requested state of the feature (true or false). value)Implements org. |
| public void | setProperty(String
the property name, which is a fully-qualified URI. name, Object the requested value for the property. value)Implements org. |
| public void | setValue(String text)
Implements com. |
| private void | startDocument(boolean
whether serialization of several
object will be merge into a single
SAX document. multiObjectMode)Fires the SAX startDocument event towards the configured ContentHandler. |
| public void |
| attributeList | back to summary |
|---|---|
| private final AttributesImpl attributeList | |
| buffer | back to summary |
|---|---|
| private char[] buffer | |
| CONFIGURED_XSTREAM_PROPERTY | back to summary |
|---|---|
| public static final String CONFIGURED_XSTREAM_PROPERTY The | |
| contentHandler | back to summary |
|---|---|
| private ContentHandler contentHandler The SAX ContentHandler associated to this XMLReader. | |
| depth | back to summary |
|---|---|
| private int depth | |
| dtdHandler | back to summary |
|---|---|
| private DTDHandler dtdHandler The SAX DTDHandler associated to this XMLReader. | |
| elementStack | back to summary |
|---|---|
| private List<E> elementStack | |
| entityResolver | back to summary |
|---|---|
| private EntityResolver entityResolver The SAX EntityResolver associated to this XMLReader. | |
| errorHandler | back to summary |
|---|---|
| private ErrorHandler errorHandler The SAX ErrorHandler associated to this XMLReader. | |
| features | back to summary |
|---|---|
| private Map<K, V> features The SAX features defined for this XMLReader. This class does not define any feature (yet) and ignores the SAX mandatory feature. Thus, this member is present only to support the mandatory feature setting and retrieval logic defined by SAX. | |
| includeEnclosingDocument | back to summary |
|---|---|
| private final boolean includeEnclosingDocument | |
| properties | back to summary |
|---|---|
| private final Map<K, V> properties The SAX properties defined for this XMLReader. | |
| SOURCE_OBJECT_LIST_PROPERTY | back to summary |
|---|---|
| public static final String SOURCE_OBJECT_LIST_PROPERTY The | |
| startTagInProgress | back to summary |
|---|---|
| private boolean startTagInProgress | |
| SaxWriter | back to summary |
|---|---|
public SaxWriter(NameCoder nameCoder)
| |
| SaxWriter | back to summary |
|---|---|
public SaxWriter(boolean includeEnclosingDocument, NameCoder nameCoder)
| |
| SaxWriter | back to summary |
|---|---|
| public SaxWriter(XmlFriendlyReplacer replacer)
Deprecated As of 1.4 use | |
| SaxWriter | back to summary |
|---|---|
| public SaxWriter(boolean includeEnclosingDocument, XmlFriendlyReplacer replacer)
Deprecated As of 1.4 use | |
| SaxWriter | back to summary |
|---|---|
| public SaxWriter(boolean includeEnclosingDocument) | |
| SaxWriter | back to summary |
|---|---|
| public SaxWriter() | |
| addAttribute | back to summary |
|---|---|
| public void addAttribute(String name, String value) Implements com. | |
| close | back to summary |
|---|---|
| public void close() Implements com. Doc from com. Close the writer, if necessary. | |
| endDocument | back to summary |
|---|---|
| private void endDocument(boolean multiObjectMode) throws SAXException Fires the SAX endDocument event towards the configured ContentHandler.
| |
| endNode | back to summary |
|---|---|
| public void endNode() Implements com. | |
| flush | back to summary |
|---|---|
| public void flush() Implements com. Doc from com. Flush the writer, if necessary. | |
| flushStartTag | back to summary |
|---|---|
| private void flushStartTag() throws SAXException Fires any pending SAX startElement event towards the configured ContentHandler.
| |
| getContentHandler | back to summary |
|---|---|
| public ContentHandler getContentHandler() Implements org. Returns the current content handler.
| |
| getDTDHandler | back to summary |
|---|---|
| public DTDHandler getDTDHandler() Implements org. Returns the current DTD handler.
| |
| getEntityResolver | back to summary |
|---|---|
| public EntityResolver getEntityResolver() Implements org. Returns the current entity resolver.
| |
| getErrorHandler | back to summary |
|---|---|
| public ErrorHandler getErrorHandler() Implements org. Returns the current error handler.
| |
| getFeature | back to summary |
|---|---|
| public boolean getFeature(String name) throws SAXNotRecognizedException Implements org. Looks up the value of a feature. The feature name is any fully-qualified URI. It is possible for an XMLReader to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is performing validation or expanding external entities.
All XMLReaders are required to recognize the
Some feature values may be available only in specific contexts, such as before, during, or after a parse. Implementors are free (and encouraged) to invent their own features, using names built on their own URIs.
| |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String name) throws SAXNotRecognizedException Implements org. Looks up the value of a property. The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to return its state. XMLReaders are not required to recognize any specific property names, though an initial core set is documented for SAX2. Some property values may be available only in specific contexts, such as before, during, or after a parse. Implementors are free (and encouraged) to invent their own properties, using names built on their own URIs.
| |
| parse | back to summary |
|---|---|
| public void parse(String systemId) throws SAXException Implements org. Parses an XML document from a system identifier (URI). This method is a shortcut for the common case of reading a document from a system identifier. It is the exact equivalent of the following: parse(new InputSource(systemId)); If the system identifier is a URL, it must be fully resolved by the application before it is passed to the parser. Note As a custom SAX parser, this class
ignores the
| |
| parse | back to summary |
|---|---|
| public void parse(InputSource input) throws SAXException Implements org. Parse an XML document. The application can use this method to instruct the XML reader to begin parsing an XML document from any valid input source (a character stream, a byte stream, or a URI). Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source. During the parse, the XMLReader will provide information about the XML document through the registered event handlers. This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception. Note As a custom SAX parser, this class
ignores the
| |
| parse | back to summary |
|---|---|
| private void parse() throws SAXException Serializes the Java objects of the configured list into a flow of SAX events.
| |
| setContentHandler | back to summary |
|---|---|
| public void setContentHandler(ContentHandler handler) Implements org. Allows an application to register a content event handler. If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setDTDHandler | back to summary |
|---|---|
| public void setDTDHandler(DTDHandler handler) Implements org. Allows an application to register a DTD event handler. If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setEntityResolver | back to summary |
|---|---|
| public void setEntityResolver(EntityResolver resolver) Implements org. Allows an application to register an entity resolver. If the application does not register an entity resolver, the XMLReader will perform its own default resolution. Applications may register a new or different resolver in the middle of a parse, and the SAX parser must begin using the new resolver immediately.
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler handler) Implements org. Allows an application to register an error event handler. If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs. Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
| |
| setFeature | back to summary |
|---|---|
| public void setFeature(String name, boolean value) throws SAXNotRecognizedException Implements org. Sets the state of a feature. The feature name is any fully-qualified URI.
All XMLReaders are required to support setting
Some feature values may be immutable or mutable only in specific contexts, such as before, during, or after a parse. Note This implementation only supports the two mandatory SAX features.
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException Implements org. Sets the value of a property. The property name is any fully-qualified URI. It is possible for an XMLReader to recognize a property name but to be unable to set its value. XMLReaders are not required to recognize setting any specific property names, though a core set is provided with SAX2. Some property values may be immutable or mutable only in specific contexts, such as before, during, or after a parse. This method is also the standard mechanism for setting extended handlers. Note This implementation only supports two
(proprietary) properties:
| |
| setValue | back to summary |
|---|---|
| public void setValue(String text) Implements com. Doc from com. Write the value (text content) of the current node. | |
| startDocument | back to summary |
|---|---|
| private void startDocument(boolean multiObjectMode) throws SAXException Fires the SAX startDocument event towards the configured ContentHandler.
| |
| startNode | back to summary |
|---|---|
| public void startNode(String name) Implements com. | |