Package com.thoughtworks.xstream.io.xml
Class StaxDriver
- java.lang.Object
-
- com.thoughtworks.xstream.io.AbstractDriver
-
- com.thoughtworks.xstream.io.xml.AbstractXmlDriver
-
- com.thoughtworks.xstream.io.xml.StaxDriver
-
- All Implemented Interfaces:
HierarchicalStreamDriver
- Direct Known Subclasses:
BEAStaxDriver,SjsxpDriver,StandardStaxDriver,WstxDriver
public class StaxDriver extends AbstractXmlDriver
A driver using the StAX API to create XML reader and writer.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description private javax.xml.stream.XMLInputFactoryinputFactoryprivate javax.xml.stream.XMLOutputFactoryoutputFactoryprivate QNameMapqnameMap
-
Constructor Summary
Constructors Constructor Description StaxDriver()StaxDriver(NameCoder nameCoder)StaxDriver(QNameMap qnameMap)StaxDriver(QNameMap qnameMap, NameCoder nameCoder)StaxDriver(QNameMap qnameMap, XmlFriendlyReplacer replacer)Deprecated.As of 1.4, useStaxDriver(QNameMap, NameCoder)instead.StaxDriver(XmlFriendlyReplacer replacer)Deprecated.As of 1.4, useStaxDriver(NameCoder)instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.xml.stream.XMLInputFactorycreateInputFactory()protected javax.xml.stream.XMLOutputFactorycreateOutputFactory()protected javax.xml.stream.XMLStreamReadercreateParser(java.io.InputStream xml)protected javax.xml.stream.XMLStreamReadercreateParser(java.io.Reader xml)protected javax.xml.stream.XMLStreamReadercreateParser(javax.xml.transform.Source source)HierarchicalStreamReadercreateReader(java.io.File in)Create the HierarchicalStreamReader with the stream parser reading from a File.HierarchicalStreamReadercreateReader(java.io.InputStream in)Create the HierarchicalStreamReader with the stream parser reading from the input stream.HierarchicalStreamReadercreateReader(java.io.Reader xml)Create the HierarchicalStreamReader with the stream parser reading from the IO reader.HierarchicalStreamReadercreateReader(java.net.URL in)Create the HierarchicalStreamReader with the stream parser reading from a URL.AbstractPullReadercreateStaxReader(javax.xml.stream.XMLStreamReader in)StaxWritercreateStaxWriter(javax.xml.stream.XMLStreamWriter out)StaxWritercreateStaxWriter(javax.xml.stream.XMLStreamWriter out, boolean writeStartEndDocument)HierarchicalStreamWritercreateWriter(java.io.OutputStream out)Create the HierarchicalStreamWriter with the formatted writer.HierarchicalStreamWritercreateWriter(java.io.Writer out)Create the HierarchicalStreamWriter with the formatted writer.javax.xml.stream.XMLInputFactorygetInputFactory()javax.xml.stream.XMLOutputFactorygetOutputFactory()QNameMapgetQnameMap()booleanisRepairingNamespace()voidsetQnameMap(QNameMap qnameMap)voidsetRepairingNamespace(boolean repairing)-
Methods inherited from class com.thoughtworks.xstream.io.xml.AbstractXmlDriver
xmlFriendlyReplacer
-
Methods inherited from class com.thoughtworks.xstream.io.AbstractDriver
getNameCoder
-
-
-
-
Field Detail
-
qnameMap
private QNameMap qnameMap
-
inputFactory
private javax.xml.stream.XMLInputFactory inputFactory
-
outputFactory
private javax.xml.stream.XMLOutputFactory outputFactory
-
-
Constructor Detail
-
StaxDriver
public StaxDriver()
-
StaxDriver
public StaxDriver(QNameMap qnameMap)
-
StaxDriver
public StaxDriver(NameCoder nameCoder)
- Since:
- 1.4
-
StaxDriver
public StaxDriver(QNameMap qnameMap, XmlFriendlyReplacer replacer)
Deprecated.As of 1.4, useStaxDriver(QNameMap, NameCoder)instead.- Since:
- 1.2
-
StaxDriver
public StaxDriver(XmlFriendlyReplacer replacer)
Deprecated.As of 1.4, useStaxDriver(NameCoder)instead.- Since:
- 1.2
-
-
Method Detail
-
createReader
public HierarchicalStreamReader createReader(java.io.Reader xml)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamReader with the stream parser reading from the IO reader.- Parameters:
xml- theReaderwith the data to parse- Returns:
- the HierarchicalStreamReader
-
createReader
public HierarchicalStreamReader createReader(java.io.InputStream in)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamReader with the stream parser reading from the input stream.- Parameters:
in- theInputStreamwith the data to parse
-
createReader
public HierarchicalStreamReader createReader(java.net.URL in)
Description copied from class:AbstractDriverCreate 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:
createReaderin interfaceHierarchicalStreamDriver- Overrides:
createReaderin classAbstractDriver- Parameters:
in- theURLdefining the location with the data to parse- Returns:
- the HierarchicalStreamReader
-
createReader
public HierarchicalStreamReader createReader(java.io.File in)
Description copied from class:AbstractDriverCreate 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:
createReaderin interfaceHierarchicalStreamDriver- Overrides:
createReaderin classAbstractDriver- Parameters:
in- theURLdefining the location with the data to parse- Returns:
- the HierarchicalStreamReader
-
createWriter
public HierarchicalStreamWriter createWriter(java.io.Writer out)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamWriter with the formatted writer.- Parameters:
out- theWriterto receive the formatted data- Returns:
- the HierarchicalStreamWriter
-
createWriter
public HierarchicalStreamWriter createWriter(java.io.OutputStream out)
Description copied from interface:HierarchicalStreamDriverCreate the HierarchicalStreamWriter with the formatted writer.- Parameters:
out- theOutputStreamto receive the formatted data- Returns:
- the HierarchicalStreamWriter
-
createStaxReader
public AbstractPullReader createStaxReader(javax.xml.stream.XMLStreamReader in)
-
createStaxWriter
public StaxWriter createStaxWriter(javax.xml.stream.XMLStreamWriter out, boolean writeStartEndDocument) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
createStaxWriter
public StaxWriter createStaxWriter(javax.xml.stream.XMLStreamWriter out) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
getQnameMap
public QNameMap getQnameMap()
-
setQnameMap
public void setQnameMap(QNameMap qnameMap)
-
getInputFactory
public javax.xml.stream.XMLInputFactory getInputFactory()
-
getOutputFactory
public javax.xml.stream.XMLOutputFactory getOutputFactory()
-
isRepairingNamespace
public boolean isRepairingNamespace()
-
setRepairingNamespace
public void setRepairingNamespace(boolean repairing)
- Since:
- 1.2
-
createParser
protected javax.xml.stream.XMLStreamReader createParser(java.io.Reader xml) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
createParser
protected javax.xml.stream.XMLStreamReader createParser(java.io.InputStream xml) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
createParser
protected javax.xml.stream.XMLStreamReader createParser(javax.xml.transform.Source source) throws javax.xml.stream.XMLStreamException- Throws:
javax.xml.stream.XMLStreamException
-
createInputFactory
protected javax.xml.stream.XMLInputFactory createInputFactory()
- Since:
- 1.4
-
createOutputFactory
protected javax.xml.stream.XMLOutputFactory createOutputFactory()
- Since:
- 1.4
-
-