public class XMLStreamRecorder extends XMLWriterBase
Writes XML in a non-xml format to create XML tests.
context, DEFAULTNS
Constructor and Description |
---|
XMLStreamRecorder() |
XMLStreamRecorder(java.io.Writer writer) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeEndTag() |
protected void |
closeStartTag() |
static void |
main(java.lang.String[] args) |
protected void |
openEndTag() |
protected void |
openStartTag() |
void |
write(javax.xml.stream.XMLStreamReader xmlr) |
void |
writeAttribute(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String value)
Writes an attribute to the output stream
|
void |
writeCData(java.lang.String data)
Writes a CData section
|
protected void |
writeCharactersInternal(char[] characters,
int start,
int length,
boolean isAttributeValue) |
void |
writeComment(java.lang.String data)
Writes an xml comment with the data enclosed
|
void |
writeDefaultNamespace(java.lang.String namespaceURI)
Writes the default namespace to the stream
|
void |
writeDTD(java.lang.String dtd)
Write a DTD section.
|
void |
writeEntityRef(java.lang.String name)
Writes an entity reference
|
protected java.lang.String |
writeName(java.lang.String prefix,
java.lang.String namespaceURI,
java.lang.String localName) |
void |
writeNamespace(java.lang.String prefix,
java.lang.String namespaceURI)
Writes a namespace to the output stream
If the prefix argument to this method is the empty string,
"xmlns", or null this method will delegate to writeDefaultNamespace
|
void |
writeProcessingInstruction(java.lang.String target,
java.lang.String text)
Writes a processing instruction
|
void |
writeStartDocument()
Write the XML Declaration.
|
void |
writeStartDocument(java.lang.String version)
Write the XML Declaration.
|
void |
writeStartDocument(java.lang.String encoding,
java.lang.String version)
Write the XML Declaration.
|
protected void |
writeType(int type) |
close, closeStartElement, flush, getNamespaceContext, getPrefix, getProperty, getURIInternal, isOpen, setConfigurationContext, setDefaultNamespace, setNamespaceContext, setPrefix, setWriter, write, write, write, write, writeAttribute, writeAttribute, writeCharacters, writeCharacters, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndDocument, writeEndElement, writeProcessingInstruction, writeRaw, writeStartElement, writeStartElement, writeStartElement, writeStartElementInternal
setStreamWriter, writeAll
public XMLStreamRecorder()
public XMLStreamRecorder(java.io.Writer writer)
protected java.lang.String writeName(java.lang.String prefix, java.lang.String namespaceURI, java.lang.String localName) throws javax.xml.stream.XMLStreamException
writeName
in class XMLWriterBase
javax.xml.stream.XMLStreamException
protected void writeType(int type) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void openStartTag() throws javax.xml.stream.XMLStreamException
openStartTag
in class XMLWriterBase
javax.xml.stream.XMLStreamException
protected void closeStartTag() throws javax.xml.stream.XMLStreamException
closeStartTag
in class XMLWriterBase
javax.xml.stream.XMLStreamException
protected void openEndTag() throws javax.xml.stream.XMLStreamException
openEndTag
in class XMLWriterBase
javax.xml.stream.XMLStreamException
protected void closeEndTag() throws javax.xml.stream.XMLStreamException
closeEndTag
in class XMLWriterBase
javax.xml.stream.XMLStreamException
public void writeAttribute(java.lang.String namespaceURI, java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeAttribute
in interface javax.xml.stream.XMLStreamWriter
writeAttribute
in class XMLWriterBase
namespaceURI
- the uri of the prefix for this attributelocalName
- the local name of the attributevalue
- the value of the attributejavax.xml.stream.XMLStreamException
- if the namespace URI has not been bound to a prefix and
javax.xml.stream.isPrefixDefaulting has not been set to truepublic void writeNamespace(java.lang.String prefix, java.lang.String namespaceURI) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeNamespace
in interface javax.xml.stream.XMLStreamWriter
writeNamespace
in class XMLWriterBase
prefix
- the prefix to bind this namespace tonamespaceURI
- the uri to bind the prefix tojavax.xml.stream.XMLStreamException
public void writeDefaultNamespace(java.lang.String namespaceURI) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeDefaultNamespace
in interface javax.xml.stream.XMLStreamWriter
writeDefaultNamespace
in class XMLWriterBase
namespaceURI
- the uri to bind the default namespace tojavax.xml.stream.XMLStreamException
public void writeComment(java.lang.String data) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeComment
in interface javax.xml.stream.XMLStreamWriter
writeComment
in class XMLWriterBase
data
- the data contained in the comment, may be nulljavax.xml.stream.XMLStreamException
public void writeProcessingInstruction(java.lang.String target, java.lang.String text) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeProcessingInstruction
in interface javax.xml.stream.XMLStreamWriter
writeProcessingInstruction
in class XMLWriterBase
target
- the target of the processing instruction, may not be nulltext
- the data contained in the processing instruction, may not be nulljavax.xml.stream.XMLStreamException
public void writeDTD(java.lang.String dtd) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeDTD
in interface javax.xml.stream.XMLStreamWriter
writeDTD
in class XMLWriterBase
dtd
- the DTD to be writtenjavax.xml.stream.XMLStreamException
public void writeCData(java.lang.String data) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeCData
in interface javax.xml.stream.XMLStreamWriter
writeCData
in class XMLWriterBase
data
- the data contained in the CData Section, may not be nulljavax.xml.stream.XMLStreamException
public void writeEntityRef(java.lang.String name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeEntityRef
in interface javax.xml.stream.XMLStreamWriter
writeEntityRef
in class XMLWriterBase
name
- the name of the entityjavax.xml.stream.XMLStreamException
public void writeStartDocument() throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
writeStartDocument
in class XMLWriterBase
javax.xml.stream.XMLStreamException
public void writeStartDocument(java.lang.String version) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
writeStartDocument
in class XMLWriterBase
version
- version of the xml documentjavax.xml.stream.XMLStreamException
public void writeStartDocument(java.lang.String encoding, java.lang.String version) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriter
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
writeStartDocument
in class XMLWriterBase
encoding
- encoding of the xml declarationversion
- version of the xml documentjavax.xml.stream.XMLStreamException
protected void writeCharactersInternal(char[] characters, int start, int length, boolean isAttributeValue) throws javax.xml.stream.XMLStreamException
writeCharactersInternal
in class XMLWriterBase
javax.xml.stream.XMLStreamException
public void write(javax.xml.stream.XMLStreamReader xmlr) throws javax.xml.stream.XMLStreamException
write
in class ReaderToWriter
javax.xml.stream.XMLStreamException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception