| java.lang.Object javanet.staxutils.io.XMLWriterUtils
XMLWriterUtils | final public class XMLWriterUtils (Code) | | Set of utility methods useful when writing XML.
author: Christian Niles version: $Revision: 1.6 $ |
Method Summary | |
final public static void | writeAttribute(Attribute attr, Writer writer) Writes an
Attribute to the provided stream. | final public static void | writeAttribute(QName name, String value, Writer writer) Writes an attribute to the provided stream. | final public static void | writeAttribute(Attribute attr, XMLStreamWriter writer) Writes an
Attribute to the provided stream. | final public static void | writeCData(String text, Writer writer) Writes a
Characters to the provided stream. | final public static void | writeCData(char[] data, int start, int length, Writer writer) Writes a
Characters to the provided stream. | final public static void | writeCharacters(Characters chars, Writer writer) Writes a
Characters to the provided stream. | final public static void | writeCharacters(CharSequence text, Writer writer) Writes a chunk of encoded text to the provided stream. | final public static void | writeCharacters(char[] data, int start, int length, Writer writer) Writes a chunk of encoded text to the provided stream. | final public static void | writeCharacters(Characters chars, XMLStreamWriter writer) Writes a
Characters to the provided stream. | final public static void | writeComment(Comment comment, Writer writer) Writes a
Comment to the provided stream. | final public static void | writeComment(String comment, Writer writer) Writes a comment to the provided stream. | final public static void | writeComment(Comment comment, XMLStreamWriter writer) Writes a
Comment to the provided stream. | final public static void | writeDTD(DTD dtd, Writer writer) Writes a
DTD to the provided stream. | final public static void | writeDTD(String dtd, Writer writer) Writes a dtd to the provided stream. | final public static void | writeDTD(DTD dtd, XMLStreamWriter writer) Writes a
DTD to the provided stream. | final public static void | writeEncodedCharacter(char c, Writer writer) Encodes the provided character if needed, and writes it to an output stream. | final public static void | writeEncodedQuotedValue(String value, Writer writer) Encodes the given value and writes it to the provided stream, wrapping it in
the appropriate quote character. | final public static void | writeEncodedText(CharSequence text, Writer writer) Encodes the provided text and writes it to the provided stream. | final public static void | writeEncodedText(char[] text, int start, int len, Writer writer) | final public static void | writeEncodedValue(String value, char quoteChar, Writer writer) Encodes the given value, and writes it to the stream, but does not actually
wrap the value in the quote character. | final public static void | writeEndDocument(EndDocument end, Writer writer) Writes an
EndDocument to the provided stream. | final public static void | writeEndDocument(Writer writer) Writes an document ending to the provided stream. | final public static void | writeEndDocument(EndDocument end, XMLStreamWriter writer) Writes an
EndDocument to the provided stream. | final public static void | writeEndElement(EndElement end, Writer writer) Writes an
EndElement to the provided stream. | final public static void | writeEndElement(QName name, Writer writer) Writes an element end tag to the provided stream. | final public static void | writeEndElement(EndElement end, XMLStreamWriter writer) Writes an
EndElement to the provided stream. | final public static void | writeEntityDeclaration(EntityDeclaration declaration, Writer writer) Writes an
EntityDeclaration to the stream. | final public static void | writeEntityDeclaration(String name, String publicId, String systemId, String notation, Writer writer) Writes an external entity declaration to the stream. | final public static void | writeEntityDeclaration(String name, String text, String notation, Writer writer) Writes an internal entity declaration to the stream. | final public static void | writeEntityReference(EntityReference entityRef, Writer writer) Writes an
EntityReference to the provided stream. | final public static void | writeEntityReference(String entityRef, Writer writer) Writes an entity reference to the provided stream. | final public static void | writeEntityReference(EntityReference entityRef, XMLStreamWriter writer) Writes an
EntityReference to the provided stream. | final public static void | writeEvent(XMLEvent event, Writer writer) Writes the given event to the provided
Writer . | final public static void | writeEvent(XMLEvent event, XMLStreamWriter writer) Writes the given event to the provided
XMLStreamWriter . | final public static void | writeNamespace(Namespace ns, Writer writer) Writes a
Namespace to the provided stream. | final public static void | writeNamespace(String prefix, String uri, Writer writer) Writes a
Namespace to the provided stream. | final public static void | writeNamespace(Namespace ns, XMLStreamWriter writer) Writes a
Namespace to the provided stream. | final public static void | writeNotationDeclaration(NotationDeclaration declaration, Writer writer) Writes a
NotationDeclaration to the stream. | final public static void | writeNotationDeclaration(String name, String publicId, String systemId, Writer writer) Writes a notation declaration to the stream. | final public static void | writeProcessingInstruction(ProcessingInstruction procInst, Writer writer) Writes a
ProcessingInstruction to the provided stream. | final public static void | writeProcessingInstruction(String target, String data, Writer writer) Writes a
ProcessingInstruction to the provided stream. | final public static void | writeProcessingInstruction(ProcessingInstruction procInst, XMLStreamWriter writer) Writes a
ProcessingInstruction to the provided stream. | final public static void | writeQName(QName name, Writer writer) Writes a qualified name to the provided stream. | final public static void | writeQName(String prefix, String localPart, Writer writer) Writes a qualified name to the provided stream. | final public static void | writeQuotedValue(String value, Writer writer) Writes a quoted version of the given value, automatically determining the
appropriate quote character. | final public static void | writeStartDocument(StartDocument start, Writer writer) Writes a
StartDocument to the provided stream. | final public static void | writeStartDocument(Writer writer) Writes a default XML declaration to the provided stream. | final public static void | writeStartDocument(String version, Writer writer) Writes an XML declaration to the provided stream. | final public static void | writeStartDocument(String version, String encoding, Writer writer) Writes an XML declaration to the provided stream. | final public static void | writeStartDocument(String version, String encoding, boolean standalone, Writer writer) Writes an XML declaration to the provided stream. | final public static void | writeStartDocument(String version, String encoding, String standalone, Writer writer) Writes an XML declaration to the provided stream. | final public static void | writeStartDocument(StartDocument start, XMLStreamWriter writer) Writes a
StartDocument to the provided stream. | final public static void | writeStartElement(StartElement start, Writer writer) Writes a
StartElement event to the provided stream. | final public static void | writeStartElement(StartElement start, boolean empty, Writer writer) Writes a
StartElement event to the provided stream. | final public static void | writeStartElement(QName name, Iterator attributes, Iterator namespaces, Writer writer) Writes a start tag and any associated namespaces and attributes to the
provided stream. | final public static void | writeStartElement(QName name, Iterator attributes, Iterator namespaces, boolean empty, Writer writer) Writes a start tag and any associated namespaces and attributes to the
provided stream. | final public static void | writeStartElement(QName name, Map attributes, Map namespaces, boolean empty, Writer writer) Writes a start tag and any associated namespaces and attributes to the
provided stream.
Parameters: name - The tag name. Parameters: attributes - A Map of attribute values, keyed by theirQNames. | final public static void | writeStartElement(StartElement start, boolean empty, XMLStreamWriter writer) Writes a
StartElement event to the provided stream. |
writeAttribute | final public static void writeAttribute(QName name, String value, Writer writer) throws IOException(Code) | | Writes an attribute to the provided stream.
Parameters: name - The attribute name. Parameters: value - The attribute value. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeCData | final public static void writeCData(String text, Writer writer) throws IOException(Code) | | Writes a
Characters to the provided stream.
Parameters: text - The CData text to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeCData | final public static void writeCData(char[] data, int start, int length, Writer writer) throws IOException(Code) | | Writes a
Characters to the provided stream.
Parameters: data - A character array containing the cdata text. Parameters: start - The starting index into the array. Parameters: length - The number of characters to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeCharacters | final public static void writeCharacters(CharSequence text, Writer writer) throws IOException(Code) | | Writes a chunk of encoded text to the provided stream.
Parameters: text - The text to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeCharacters | final public static void writeCharacters(char[] data, int start, int length, Writer writer) throws IOException(Code) | | Writes a chunk of encoded text to the provided stream.
Parameters: data - A character array containing the characters. Parameters: start - The starting index into the array. Parameters: length - The number of characters to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeComment | final public static void writeComment(String comment, Writer writer) throws IOException(Code) | | Writes a comment to the provided stream.
Parameters: comment - The comment text. Parameters: writer - The destination stream. throws: XMLStreamException - If an error occurs writing to the stream. |
writeDTD | final public static void writeDTD(DTD dtd, Writer writer) throws IOException(Code) | | Writes a
DTD to the provided stream.
Parameters: dtd - The DTD to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeDTD | final public static void writeDTD(String dtd, Writer writer) throws IOException(Code) | | Writes a dtd to the provided stream.
Parameters: dtd - The dtd to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEncodedCharacter | final public static void writeEncodedCharacter(char c, Writer writer) throws IOException(Code) | | Encodes the provided character if needed, and writes it to an output stream.
Parameters: c - The character to encode and output. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEncodedQuotedValue | final public static void writeEncodedQuotedValue(String value, Writer writer) throws IOException(Code) | | Encodes the given value and writes it to the provided stream, wrapping it in
the appropriate quote character. This method is useful when writing attribute
values, and entity replacement text.
Parameters: value - The value to encode, quote, and output. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEncodedText | final public static void writeEncodedText(CharSequence text, Writer writer) throws IOException(Code) | | Encodes the provided text and writes it to the provided stream. This method is
useful when writing character data, such as element text or CData sections,
and will not encode single or double quotes.
Parameters: text - The text to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEncodedText | final public static void writeEncodedText(char[] text, int start, int len, Writer writer) throws IOException(Code) | | |
writeEncodedValue | final public static void writeEncodedValue(String value, char quoteChar, Writer writer) throws IOException(Code) | | Encodes the given value, and writes it to the stream, but does not actually
wrap the value in the quote character. The provided quote character is used to
determine whether a character must be encoded or not.
Parameters: value - The value to encode and output. Parameters: quoteChar - The quote character; used to determine which characters needto be encoded. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEndDocument | final public static void writeEndDocument(Writer writer) throws IOException(Code) | | Writes an document ending to the provided stream.
Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEndElement | final public static void writeEndElement(QName name, Writer writer) throws IOException(Code) | | Writes an element end tag to the provided stream.
Parameters: name - The element name. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEntityDeclaration | final public static void writeEntityDeclaration(String name, String publicId, String systemId, String notation, Writer writer) throws IOException(Code) | | Writes an external entity declaration to the stream. Either or both of the
publicId and systemId parameters must be
non-null .
Parameters: name - The entity name. Parameters: publicId - The entity public ID, or null . Parameters: systemId - The entity system ID, or null . Parameters: notation - The notation name, or null . Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeEntityDeclaration | final public static void writeEntityDeclaration(String name, String text, String notation, Writer writer) throws IOException(Code) | | Writes an internal entity declaration to the stream.
Parameters: name - The entity name. Parameters: text - The entity replacement text. Parameters: notation - The notation name, or null . Parameters: writer - throws: IOException - |
writeEntityReference | final public static void writeEntityReference(String entityRef, Writer writer) throws IOException(Code) | | Writes an entity reference to the provided stream.
Parameters: entityRef - The name of the entity reference. Parameters: writer - The destination stream. throws: XMLStreamException - If an error occurs writing to the stream. |
writeEvent | final public static void writeEvent(XMLEvent event, Writer writer) throws IOException, XMLStreamException(Code) | | Writes the given event to the provided
Writer . This method
will delegate the actual task of writing to the stream to the appropriate
overloaded method.
Parameters: event - The event to write. Parameters: writer - The destination XML stream. throws: IOException - If an error occurs writing to the stream. throws: XMLStreamException - If the event is a StartElement and an error occurswriting the Namespace or Attribute events. throws: IllegalArgumentException - If the event is an unknown type. |
writeEvent | final public static void writeEvent(XMLEvent event, XMLStreamWriter writer) throws XMLStreamException(Code) | | Writes the given event to the provided
XMLStreamWriter . This method
will delegate the actual task of writing to the stream to the appropriate
overloaded method.
Parameters: event - The event to write. Parameters: writer - The destination XML stream. throws: XMLStreamException - If an error occurs writing the event. |
writeNamespace | final public static void writeNamespace(String prefix, String uri, Writer writer) throws IOException(Code) | | Writes a
Namespace to the provided stream.
Parameters: prefix - The namespace prefix, which may be null . Parameters: uri - The namespace uri. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeNotationDeclaration | final public static void writeNotationDeclaration(String name, String publicId, String systemId, Writer writer) throws IOException(Code) | | Writes a notation declaration to the stream. Either or both of the
publicId and systemId parameters must be
non-null .
Parameters: name - The notation name. Parameters: publicId - The entity public ID, or null . Parameters: systemId - The entity system ID, or null . Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeProcessingInstruction | final public static void writeProcessingInstruction(String target, String data, Writer writer) throws IOException(Code) | | Writes a
ProcessingInstruction to the provided stream.
Parameters: target - The instruction target. Parameters: data - The instruction data, or null . Parameters: writer - The destination stream. throws: XMLStreamException - If an error occurs writing to the stream. |
writeQName | final public static void writeQName(QName name, Writer writer) throws IOException(Code) | | Writes a qualified name to the provided stream.
Parameters: name - The name to write. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeQName | final public static void writeQName(String prefix, String localPart, Writer writer) throws IOException(Code) | | Writes a qualified name to the provided stream.
Parameters: prefix - The prefix, or null Parameters: localPart - The local part. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeQuotedValue | final public static void writeQuotedValue(String value, Writer writer) throws IOException(Code) | | Writes a quoted version of the given value, automatically determining the
appropriate quote character. The value will not be encoded before being
written. This method is useful when writing quoted DTD values, such as system
IDs.
Parameters: value - The value to quote and output. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartDocument | final public static void writeStartDocument(Writer writer) throws IOException(Code) | | Writes a default XML declaration to the provided stream.
Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartDocument | final public static void writeStartDocument(String version, Writer writer) throws IOException(Code) | | Writes an XML declaration to the provided stream.
Parameters: version - The xml version definition. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartDocument | final public static void writeStartDocument(String version, String encoding, Writer writer) throws IOException(Code) | | Writes an XML declaration to the provided stream.
Parameters: version - The xml version definition. Parameters: encoding - The document encoding, or null Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartDocument | final public static void writeStartDocument(String version, String encoding, boolean standalone, Writer writer) throws IOException(Code) | | Writes an XML declaration to the provided stream.
Parameters: version - The xml version definition. Parameters: encoding - The document encoding, or null Parameters: standalone - The standalone definition Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartDocument | final public static void writeStartDocument(String version, String encoding, String standalone, Writer writer) throws IOException(Code) | | Writes an XML declaration to the provided stream.
Parameters: version - The xml version definition. Parameters: encoding - The document encoding, or null Parameters: standalone - The standalone definition, or null Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
writeStartElement | final public static void writeStartElement(QName name, Iterator attributes, Iterator namespaces, Writer writer) throws IOException, XMLStreamException(Code) | | Writes a start tag and any associated namespaces and attributes to the
provided stream.
Parameters: name - The tag name. Parameters: attributes - An Attribute iterator, or null . Parameters: namespaces - A Namespace iterator, or null . Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. throws: XMLStreamException - If an error occurs writing any namespaces orattribute events. |
writeStartElement | final public static void writeStartElement(QName name, Iterator attributes, Iterator namespaces, boolean empty, Writer writer) throws IOException, XMLStreamException(Code) | | Writes a start tag and any associated namespaces and attributes to the
provided stream.
Parameters: name - The tag name. Parameters: attributes - An Attribute iterator, or null . Parameters: namespaces - A Namespace iterator, or null . Parameters: empty - Whether the element is empty. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. throws: XMLStreamException - |
writeStartElement | final public static void writeStartElement(QName name, Map attributes, Map namespaces, boolean empty, Writer writer) throws IOException(Code) | | Writes a start tag and any associated namespaces and attributes to the
provided stream.
Parameters: name - The tag name. Parameters: attributes - A Map of attribute values, keyed by theirQNames. If no attributes are present, this may be null. Parameters: namespaces - A Map of namespace values, keyed by theirprefixes. If no namespaces are present, this may be null. Parameters: empty - Whether the element is empty. Parameters: writer - The destination stream. throws: IOException - If an error occurs writing to the stream. |
|
|