com.thoughtworks.xstream.io.xml
Class StaxDriver

java.lang.Object
  extended by com.thoughtworks.xstream.io.AbstractDriver
      extended by com.thoughtworks.xstream.io.xml.AbstractXmlDriver
          extended by com.thoughtworks.xstream.io.xml.StaxDriver
All Implemented Interfaces:
HierarchicalStreamDriver
Direct Known Subclasses:
BEAStaxDriver, SjsxpDriver, WstxDriver

public class StaxDriver
extends AbstractXmlDriver

A driver using the StAX API to create XML reader and writer.

Version:
$Revision: 1861 $
Author:
James Strachan, Jörg Schaible

Constructor Summary
StaxDriver()
           
StaxDriver(NameCoder nameCoder)
           
StaxDriver(QNameMap qnameMap)
           
StaxDriver(QNameMap qnameMap, NameCoder nameCoder)
           
StaxDriver(QNameMap qnameMap, XmlFriendlyReplacer replacer)
          Deprecated. As of 1.4, use StaxDriver(QNameMap, NameCoder) instead.
StaxDriver(XmlFriendlyReplacer replacer)
          Deprecated. As of 1.4, use StaxDriver(NameCoder) instead.
 
Method Summary
protected  XMLInputFactory createInputFactory()
           
protected  XMLOutputFactory createOutputFactory()
           
protected  XMLStreamReader createParser(InputStream xml)
           
protected  XMLStreamReader createParser(Reader xml)
           
protected  XMLStreamReader createParser(Source source)
           
 HierarchicalStreamReader createReader(File in)
          Create the HierarchicalStreamReader with the stream parser reading from a File.
 HierarchicalStreamReader createReader(InputStream in)
          Create the HierarchicalStreamReader with the stream parser reading from the input stream.
 HierarchicalStreamReader createReader(Reader xml)
          Create the HierarchicalStreamReader with the stream parser reading from the IO reader.
 HierarchicalStreamReader createReader(URL in)
          Create the HierarchicalStreamReader with the stream parser reading from a URL.
 AbstractPullReader createStaxReader(XMLStreamReader in)
           
 StaxWriter createStaxWriter(XMLStreamWriter out)
           
 StaxWriter createStaxWriter(XMLStreamWriter out, boolean writeStartEndDocument)
           
 HierarchicalStreamWriter createWriter(OutputStream out)
          Create the HierarchicalStreamWriter with the formatted writer.
 HierarchicalStreamWriter createWriter(Writer out)
          Create the HierarchicalStreamWriter with the formatted writer.
 XMLInputFactory getInputFactory()
           
 XMLOutputFactory getOutputFactory()
           
 QNameMap getQnameMap()
           
 boolean isRepairingNamespace()
           
 void setQnameMap(QNameMap qnameMap)
           
 void setRepairingNamespace(boolean repairing)
           
 
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlDriver
xmlFriendlyReplacer
 
Methods inherited from class com.thoughtworks.xstream.io.AbstractDriver
getNameCoder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaxDriver

public StaxDriver()

StaxDriver

public StaxDriver(QNameMap qnameMap)

StaxDriver

public StaxDriver(QNameMap qnameMap,
                  NameCoder nameCoder)
Since:
1.4

StaxDriver

public StaxDriver(NameCoder nameCoder)
Since:
1.4

StaxDriver

public StaxDriver(QNameMap qnameMap,
                  XmlFriendlyReplacer replacer)
Deprecated. As of 1.4, use StaxDriver(QNameMap, NameCoder) instead.

Since:
1.2

StaxDriver

public StaxDriver(XmlFriendlyReplacer replacer)
Deprecated. As of 1.4, use StaxDriver(NameCoder) instead.

Since:
1.2
Method Detail

createReader

public HierarchicalStreamReader createReader(Reader xml)
Description copied from interface: HierarchicalStreamDriver
Create the HierarchicalStreamReader with the stream parser reading from the IO reader.

Parameters:
xml - the Reader with the data to parse
Returns:
the HierarchicalStreamReader

createReader

public HierarchicalStreamReader createReader(InputStream in)
Description copied from interface: HierarchicalStreamDriver
Create the HierarchicalStreamReader with the stream parser reading from the input stream.

Parameters:
in - the InputStream with the data to parse

createReader

public HierarchicalStreamReader createReader(URL in)
Description copied from class: AbstractDriver
Create the HierarchicalStreamReader with the stream parser reading from a URL. Depending on the parser implementation, some might take the URL as SystemId to resolve additional references.

Specified by:
createReader in interface HierarchicalStreamDriver
Overrides:
createReader in class AbstractDriver
Parameters:
in - the URL defining the location with the data to parse
Returns:
the HierarchicalStreamReader

createReader

public HierarchicalStreamReader createReader(File in)
Description copied from class: AbstractDriver
Create the HierarchicalStreamReader with the stream parser reading from a File. Depending on the parser implementation, some might take the file path as SystemId to resolve additional references.

Specified by:
createReader in interface HierarchicalStreamDriver
Overrides:
createReader in class AbstractDriver
Parameters:
in - the URL defining the location with the data to parse
Returns:
the HierarchicalStreamReader

createWriter

public HierarchicalStreamWriter createWriter(Writer out)
Description copied from interface: HierarchicalStreamDriver
Create the HierarchicalStreamWriter with the formatted writer.

Parameters:
out - the Writer to receive the formatted data
Returns:
the HierarchicalStreamWriter

createWriter

public HierarchicalStreamWriter createWriter(OutputStream out)
Description copied from interface: HierarchicalStreamDriver
Create the HierarchicalStreamWriter with the formatted writer.

Parameters:
out - the OutputStream to receive the formatted data
Returns:
the HierarchicalStreamWriter

createStaxReader

public AbstractPullReader createStaxReader(XMLStreamReader in)

createStaxWriter

public StaxWriter createStaxWriter(XMLStreamWriter out,
                                   boolean writeStartEndDocument)
                            throws XMLStreamException
Throws:
XMLStreamException

createStaxWriter

public StaxWriter createStaxWriter(XMLStreamWriter out)
                            throws XMLStreamException
Throws:
XMLStreamException

getQnameMap

public QNameMap getQnameMap()

setQnameMap

public void setQnameMap(QNameMap qnameMap)

getInputFactory

public XMLInputFactory getInputFactory()

getOutputFactory

public XMLOutputFactory getOutputFactory()

isRepairingNamespace

public boolean isRepairingNamespace()

setRepairingNamespace

public void setRepairingNamespace(boolean repairing)
Since:
1.2

createParser

protected XMLStreamReader createParser(Reader xml)
                                throws XMLStreamException
Throws:
XMLStreamException

createParser

protected XMLStreamReader createParser(InputStream xml)
                                throws XMLStreamException
Throws:
XMLStreamException

createParser

protected XMLStreamReader createParser(Source source)
                                throws XMLStreamException
Throws:
XMLStreamException

createInputFactory

protected XMLInputFactory createInputFactory()
Since:
1.4

createOutputFactory

protected XMLOutputFactory createOutputFactory()
Since:
1.4


Copyright © 2004-2014 XStream. All Rights Reserved.