Package com.bea.xml.stream
Class XMLStreamRecorder
java.lang.Object
com.bea.xml.stream.ReaderToWriter
com.bea.xml.stream.XMLWriterBase
com.bea.xml.stream.XMLStreamRecorder
- All Implemented Interfaces:
XMLStreamWriter
Writes XML in a non-xml format to create XML tests.
-
Field Summary
Fields inherited from class com.bea.xml.stream.XMLWriterBase
context, DEFAULTNS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
static void
protected void
protected void
void
write
(XMLStreamReader xmlr) void
writeAttribute
(String namespaceURI, String localName, String value) Writes an attribute to the output streamvoid
writeCData
(String data) Writes a CData sectionprotected void
writeCharactersInternal
(char[] characters, int start, int length, boolean isAttributeValue) void
writeComment
(String data) Writes an xml comment with the data enclosedvoid
writeDefaultNamespace
(String namespaceURI) Writes the default namespace to the streamvoid
Write a DTD section.void
writeEntityRef
(String name) Writes an entity referenceprotected String
void
writeNamespace
(String prefix, 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 writeDefaultNamespacevoid
writeProcessingInstruction
(String target, String text) Writes a processing instructionvoid
Write the XML Declaration.void
writeStartDocument
(String version) Write the XML Declaration.void
writeStartDocument
(String encoding, String version) Write the XML Declaration.protected void
writeType
(int type) Methods inherited from class com.bea.xml.stream.XMLWriterBase
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
Methods inherited from class com.bea.xml.stream.ReaderToWriter
setStreamWriter, writeAll
-
Constructor Details
-
XMLStreamRecorder
public XMLStreamRecorder() -
XMLStreamRecorder
-
-
Method Details
-
writeName
protected String writeName(String prefix, String namespaceURI, String localName) throws XMLStreamException - Overrides:
writeName
in classXMLWriterBase
- Throws:
XMLStreamException
-
writeType
- Throws:
XMLStreamException
-
openStartTag
- Overrides:
openStartTag
in classXMLWriterBase
- Throws:
XMLStreamException
-
closeStartTag
- Overrides:
closeStartTag
in classXMLWriterBase
- Throws:
XMLStreamException
-
openEndTag
- Overrides:
openEndTag
in classXMLWriterBase
- Throws:
XMLStreamException
-
closeEndTag
- Overrides:
closeEndTag
in classXMLWriterBase
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes an attribute to the output stream- Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Overrides:
writeAttribute
in classXMLWriterBase
- Parameters:
namespaceURI
- the uri of the prefix for this attributelocalName
- the local name of the attributevalue
- the value of the attribute- Throws:
XMLStreamException
- if the namespace URI has not been bound to a prefix and javax.xml.stream.isPrefixDefaulting has not been set to true
-
writeNamespace
Description copied from interface:javax.xml.stream.XMLStreamWriter
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- Specified by:
writeNamespace
in interfaceXMLStreamWriter
- Overrides:
writeNamespace
in classXMLWriterBase
- Parameters:
prefix
- the prefix to bind this namespace tonamespaceURI
- the uri to bind the prefix to- Throws:
XMLStreamException
-
writeDefaultNamespace
Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes the default namespace to the stream- Specified by:
writeDefaultNamespace
in interfaceXMLStreamWriter
- Overrides:
writeDefaultNamespace
in classXMLWriterBase
- Parameters:
namespaceURI
- the uri to bind the default namespace to- Throws:
XMLStreamException
-
writeComment
Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes an xml comment with the data enclosed- Specified by:
writeComment
in interfaceXMLStreamWriter
- Overrides:
writeComment
in classXMLWriterBase
- Parameters:
data
- the data contained in the comment, may be null- Throws:
XMLStreamException
-
writeProcessingInstruction
Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes a processing instruction- Specified by:
writeProcessingInstruction
in interfaceXMLStreamWriter
- Overrides:
writeProcessingInstruction
in classXMLWriterBase
- Parameters:
target
- the target of the processing instruction, may not be nulltext
- the data contained in the processing instruction, may not be null- Throws:
XMLStreamException
-
writeDTD
Description copied from interface:javax.xml.stream.XMLStreamWriter
Write a DTD section. This string represents the entire doctypedecl production from the XML 1.0 specification.- Specified by:
writeDTD
in interfaceXMLStreamWriter
- Overrides:
writeDTD
in classXMLWriterBase
- Parameters:
dtd
- the DTD to be written- Throws:
XMLStreamException
-
writeCData
Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes a CData section- Specified by:
writeCData
in interfaceXMLStreamWriter
- Overrides:
writeCData
in classXMLWriterBase
- Parameters:
data
- the data contained in the CData Section, may not be null- Throws:
XMLStreamException
-
writeEntityRef
Description copied from interface:javax.xml.stream.XMLStreamWriter
Writes an entity reference- Specified by:
writeEntityRef
in interfaceXMLStreamWriter
- Overrides:
writeEntityRef
in classXMLWriterBase
- Parameters:
name
- the name of the entity- Throws:
XMLStreamException
-
writeStartDocument
Description copied from interface:javax.xml.stream.XMLStreamWriter
Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Overrides:
writeStartDocument
in classXMLWriterBase
- Throws:
XMLStreamException
-
writeStartDocument
Description copied from interface:javax.xml.stream.XMLStreamWriter
Write the XML Declaration. Defaults the XML version to 1.0- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Overrides:
writeStartDocument
in classXMLWriterBase
- Parameters:
version
- version of the xml document- Throws:
XMLStreamException
-
writeStartDocument
Description copied from interface:javax.xml.stream.XMLStreamWriter
Write the XML Declaration. Note that the encoding parameter does not set the actual encoding of the underlying output. That must be set when the instance of the XMLStreamWriter is created using the XMLOutputFactory- Specified by:
writeStartDocument
in interfaceXMLStreamWriter
- Overrides:
writeStartDocument
in classXMLWriterBase
- Parameters:
encoding
- encoding of the xml declarationversion
- version of the xml document- Throws:
XMLStreamException
-
writeCharactersInternal
protected void writeCharactersInternal(char[] characters, int start, int length, boolean isAttributeValue) throws XMLStreamException - Overrides:
writeCharactersInternal
in classXMLWriterBase
- Throws:
XMLStreamException
-
write
- Overrides:
write
in classReaderToWriter
- Throws:
XMLStreamException
-
main
- Throws:
Exception
-