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, writeStartElementInternalsetStreamWriter, writeAllpublic 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 XMLWriterBasejavax.xml.stream.XMLStreamExceptionprotected void writeType(int type)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected void openStartTag()
throws javax.xml.stream.XMLStreamException
openStartTag in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionprotected void closeStartTag()
throws javax.xml.stream.XMLStreamException
closeStartTag in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionprotected void openEndTag()
throws javax.xml.stream.XMLStreamException
openEndTag in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionprotected void closeEndTag()
throws javax.xml.stream.XMLStreamException
closeEndTag in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String value)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteAttribute in interface javax.xml.stream.XMLStreamWriterwriteAttribute in class XMLWriterBasenamespaceURI - 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.XMLStreamWriterwriteNamespace in interface javax.xml.stream.XMLStreamWriterwriteNamespace in class XMLWriterBaseprefix - the prefix to bind this namespace tonamespaceURI - the uri to bind the prefix tojavax.xml.stream.XMLStreamExceptionpublic void writeDefaultNamespace(java.lang.String namespaceURI)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteDefaultNamespace in interface javax.xml.stream.XMLStreamWriterwriteDefaultNamespace in class XMLWriterBasenamespaceURI - the uri to bind the default namespace tojavax.xml.stream.XMLStreamExceptionpublic void writeComment(java.lang.String data)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteComment in interface javax.xml.stream.XMLStreamWriterwriteComment in class XMLWriterBasedata - the data contained in the comment, may be nulljavax.xml.stream.XMLStreamExceptionpublic void writeProcessingInstruction(java.lang.String target,
java.lang.String text)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteProcessingInstruction in interface javax.xml.stream.XMLStreamWriterwriteProcessingInstruction in class XMLWriterBasetarget - the target of the processing instruction, may not be nulltext - the data contained in the processing instruction, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeDTD(java.lang.String dtd)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteDTD in interface javax.xml.stream.XMLStreamWriterwriteDTD in class XMLWriterBasedtd - the DTD to be writtenjavax.xml.stream.XMLStreamExceptionpublic void writeCData(java.lang.String data)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteCData in interface javax.xml.stream.XMLStreamWriterwriteCData in class XMLWriterBasedata - the data contained in the CData Section, may not be nulljavax.xml.stream.XMLStreamExceptionpublic void writeEntityRef(java.lang.String name)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteEntityRef in interface javax.xml.stream.XMLStreamWriterwriteEntityRef in class XMLWriterBasename - the name of the entityjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteStartDocument in interface javax.xml.stream.XMLStreamWriterwriteStartDocument in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(java.lang.String version)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteStartDocument in interface javax.xml.stream.XMLStreamWriterwriteStartDocument in class XMLWriterBaseversion - version of the xml documentjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(java.lang.String encoding,
java.lang.String version)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamWriterwriteStartDocument in interface javax.xml.stream.XMLStreamWriterwriteStartDocument in class XMLWriterBaseencoding - encoding of the xml declarationversion - version of the xml documentjavax.xml.stream.XMLStreamExceptionprotected void writeCharactersInternal(char[] characters,
int start,
int length,
boolean isAttributeValue)
throws javax.xml.stream.XMLStreamException
writeCharactersInternal in class XMLWriterBasejavax.xml.stream.XMLStreamExceptionpublic void write(javax.xml.stream.XMLStreamReader xmlr)
throws javax.xml.stream.XMLStreamException
write in class ReaderToWriterjavax.xml.stream.XMLStreamExceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception