|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavanet.staxutils.io.XMLWriterUtils
public final class XMLWriterUtils
Set of utility methods useful when writing XML.
| Method Summary | |
|---|---|
static void |
writeAttribute(Attribute attr,
Writer writer)
Writes an Attribute to the provided stream. |
static void |
writeAttribute(Attribute attr,
XMLStreamWriter writer)
Writes an Attribute to the provided stream. |
static void |
writeAttribute(QName name,
String value,
Writer writer)
Writes an attribute to the provided stream. |
static void |
writeCData(char[] data,
int start,
int length,
Writer writer)
Writes a Characters to the provided stream. |
static void |
writeCData(String text,
Writer writer)
Writes a Characters to the provided stream. |
static void |
writeCharacters(char[] data,
int start,
int length,
Writer writer)
Writes a chunk of encoded text to the provided stream. |
static void |
writeCharacters(Characters chars,
Writer writer)
Writes a Characters to the provided stream. |
static void |
writeCharacters(Characters chars,
XMLStreamWriter writer)
Writes a Characters to the provided stream. |
static void |
writeCharacters(CharSequence text,
Writer writer)
Writes a chunk of encoded text to the provided stream. |
static void |
writeComment(Comment comment,
Writer writer)
Writes a Comment to the provided stream. |
static void |
writeComment(Comment comment,
XMLStreamWriter writer)
Writes a Comment to the provided stream. |
static void |
writeComment(String comment,
Writer writer)
Writes a comment to the provided stream. |
static void |
writeDTD(DTD dtd,
Writer writer)
Writes a DTD to the provided stream. |
static void |
writeDTD(DTD dtd,
XMLStreamWriter writer)
Writes a DTD to the provided stream. |
static void |
writeDTD(String dtd,
Writer writer)
Writes a dtd to the provided stream. |
static void |
writeEncodedCharacter(char c,
Writer writer)
Encodes the provided character if needed, and writes it to an output stream. |
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. |
static void |
writeEncodedText(char[] text,
int start,
int len,
Writer writer)
|
static void |
writeEncodedText(CharSequence text,
Writer writer)
Encodes the provided text and writes it to the provided stream. |
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. |
static void |
writeEndDocument(EndDocument end,
Writer writer)
Writes an EndDocument to the provided stream. |
static void |
writeEndDocument(EndDocument end,
XMLStreamWriter writer)
Writes an EndDocument to the provided stream. |
static void |
writeEndDocument(Writer writer)
Writes an document ending to the provided stream. |
static void |
writeEndElement(EndElement end,
Writer writer)
Writes an EndElement to the provided stream. |
static void |
writeEndElement(EndElement end,
XMLStreamWriter writer)
Writes an EndElement to the provided stream. |
static void |
writeEndElement(QName name,
Writer writer)
Writes an element end tag to the provided stream. |
static void |
writeEntityDeclaration(EntityDeclaration declaration,
Writer writer)
Writes an EntityDeclaration to the stream. |
static void |
writeEntityDeclaration(String name,
String publicId,
String systemId,
String notation,
Writer writer)
Writes an external entity declaration to the stream. |
static void |
writeEntityDeclaration(String name,
String text,
String notation,
Writer writer)
Writes an internal entity declaration to the stream. |
static void |
writeEntityReference(EntityReference entityRef,
Writer writer)
Writes an EntityReference to the provided stream. |
static void |
writeEntityReference(EntityReference entityRef,
XMLStreamWriter writer)
Writes an EntityReference to the provided stream. |
static void |
writeEntityReference(String entityRef,
Writer writer)
Writes an entity reference to the provided stream. |
static void |
writeEvent(XMLEvent event,
Writer writer)
Writes the given event to the provided Writer. |
static void |
writeEvent(XMLEvent event,
XMLStreamWriter writer)
Writes the given event to the provided XMLStreamWriter. |
static void |
writeNamespace(Namespace ns,
Writer writer)
Writes a Namespace to the provided stream. |
static void |
writeNamespace(Namespace ns,
XMLStreamWriter writer)
Writes a Namespace to the provided stream. |
static void |
writeNamespace(String prefix,
String uri,
Writer writer)
Writes a Namespace to the provided stream. |
static void |
writeNotationDeclaration(NotationDeclaration declaration,
Writer writer)
Writes a NotationDeclaration to the stream. |
static void |
writeNotationDeclaration(String name,
String publicId,
String systemId,
Writer writer)
Writes a notation declaration to the stream. |
static void |
writeProcessingInstruction(ProcessingInstruction procInst,
Writer writer)
Writes a ProcessingInstruction to the provided stream. |
static void |
writeProcessingInstruction(ProcessingInstruction procInst,
XMLStreamWriter writer)
Writes a ProcessingInstruction to the provided stream. |
static void |
writeProcessingInstruction(String target,
String data,
Writer writer)
Writes a ProcessingInstruction to the provided stream. |
static void |
writeQName(QName name,
Writer writer)
Writes a qualified name to the provided stream. |
static void |
writeQName(String prefix,
String localPart,
Writer writer)
Writes a qualified name to the provided stream. |
static void |
writeQuotedValue(String value,
Writer writer)
Writes a quoted version of the given value, automatically determining the appropriate quote character. |
static void |
writeStartDocument(StartDocument start,
Writer writer)
Writes a StartDocument to the provided stream. |
static void |
writeStartDocument(StartDocument start,
XMLStreamWriter writer)
Writes a StartDocument to the provided stream. |
static void |
writeStartDocument(String version,
String encoding,
boolean standalone,
Writer writer)
Writes an XML declaration to the provided stream. |
static void |
writeStartDocument(String version,
String encoding,
String standalone,
Writer writer)
Writes an XML declaration to the provided stream. |
static void |
writeStartDocument(String version,
String encoding,
Writer writer)
Writes an XML declaration to the provided stream. |
static void |
writeStartDocument(String version,
Writer writer)
Writes an XML declaration to the provided stream. |
static void |
writeStartDocument(Writer writer)
Writes a default XML declaration to the provided stream. |
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. |
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. |
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. |
static void |
writeStartElement(StartElement start,
boolean empty,
Writer writer)
Writes a StartElement event to the provided stream. |
static void |
writeStartElement(StartElement start,
boolean empty,
XMLStreamWriter writer)
Writes a StartElement event to the provided stream. |
static void |
writeStartElement(StartElement start,
Writer writer)
Writes a StartElement event to the provided stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final void writeQuotedValue(String value,
Writer writer)
throws IOException
value - The value to quote and output.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEncodedQuotedValue(String value,
Writer writer)
throws IOException
value - The value to encode, quote, and output.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEncodedValue(String value,
char quoteChar,
Writer writer)
throws IOException
value - The value to encode and output.quoteChar - The quote character; used to determine which characters need
to be encoded.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEncodedText(CharSequence text,
Writer writer)
throws IOException
text - The text to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEncodedText(char[] text,
int start,
int len,
Writer writer)
throws IOException
IOException
public static final void writeEncodedCharacter(char c,
Writer writer)
throws IOException
c - The character to encode and output.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeQName(QName name,
Writer writer)
throws IOException
name - The name to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeQName(String prefix,
String localPart,
Writer writer)
throws IOException
prefix - The prefix, or nulllocalPart - The local part.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEvent(XMLEvent event,
Writer writer)
throws IOException,
XMLStreamException
Writer. This method
will delegate the actual task of writing to the stream to the appropriate
overloaded method.
event - The event to write.writer - The destination XML stream.
IOException - If an error occurs writing to the stream.
XMLStreamException - If the event is a StartElement and an error occurs
writing the Namespace or Attribute events.
IllegalArgumentException - If the event is an unknown type.
public static final void writeStartDocument(StartDocument start,
Writer writer)
throws IOException
StartDocument to the provided stream.
start - The StartDocument to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartDocument(Writer writer)
throws IOException
writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartDocument(String version,
Writer writer)
throws IOException
version - The xml version definition.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartDocument(String version,
String encoding,
Writer writer)
throws IOException
version - The xml version definition.encoding - The document encoding, or nullwriter - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartDocument(String version,
String encoding,
boolean standalone,
Writer writer)
throws IOException
version - The xml version definition.encoding - The document encoding, or nullstandalone - The standalone definitionwriter - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartDocument(String version,
String encoding,
String standalone,
Writer writer)
throws IOException
version - The xml version definition.encoding - The document encoding, or nullstandalone - The standalone definition, or nullwriter - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEndDocument(EndDocument end,
Writer writer)
throws IOException
EndDocument to the provided stream.
end - The EndDocument to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEndDocument(Writer writer)
throws IOException
writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeStartElement(StartElement start,
Writer writer)
throws IOException,
XMLStreamException
StartElement event to the provided stream.
start - The StartElement event to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
XMLStreamException - If an error occurs writing any namespaces or
attribute events.
public static final void writeStartElement(StartElement start,
boolean empty,
Writer writer)
throws IOException,
XMLStreamException
StartElement event to the provided stream.
start - The StartElement event to write.empty - Whether the element is empty.writer - The destination stream.
IOException - If an error occurs writing to the stream.
XMLStreamException - If an error occurs writing any namespaces or
attribute events.
public static final void writeStartElement(QName name,
Iterator attributes,
Iterator namespaces,
Writer writer)
throws IOException,
XMLStreamException
name - The tag name.attributes - An Attribute iterator, or null.namespaces - A Namespace iterator, or null.writer - The destination stream.
IOException - If an error occurs writing to the stream.
XMLStreamException - If an error occurs writing any namespaces or
attribute events.
public static final void writeStartElement(QName name,
Iterator attributes,
Iterator namespaces,
boolean empty,
Writer writer)
throws IOException,
XMLStreamException
name - The tag name.attributes - An Attribute iterator, or null.namespaces - A Namespace iterator, or null.empty - Whether the element is empty.writer - The destination stream.
IOException - If an error occurs writing to the stream.
XMLStreamException
public static final void writeStartElement(QName name,
Map attributes,
Map namespaces,
boolean empty,
Writer writer)
throws IOException
name - The tag name.attributes - A Map of attribute values, keyed by their
QNames. If no attributes are present, this may be null.namespaces - A Map of namespace values, keyed by their
prefixes. If no namespaces are present, this may be null.empty - Whether the element is empty.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeAttribute(Attribute attr,
Writer writer)
throws IOException
Attribute to the provided stream.
attr - The Attribute to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeAttribute(QName name,
String value,
Writer writer)
throws IOException
name - The attribute name.value - The attribute value.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeNamespace(Namespace ns,
Writer writer)
throws IOException
Namespace to the provided stream.
ns - The Namespace to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeNamespace(String prefix,
String uri,
Writer writer)
throws IOException
Namespace to the provided stream.
prefix - The namespace prefix, which may be null.uri - The namespace uri.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEndElement(EndElement end,
Writer writer)
throws IOException
EndElement to the provided stream.
end - The EndElement to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEndElement(QName name,
Writer writer)
throws IOException
name - The element name.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeCharacters(Characters chars,
Writer writer)
throws IOException
Characters to the provided stream.
chars - The Characters to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeCharacters(CharSequence text,
Writer writer)
throws IOException
text - The text to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeCharacters(char[] data,
int start,
int length,
Writer writer)
throws IOException
data - A character array containing the characters.start - The starting index into the array.length - The number of characters to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeCData(String text,
Writer writer)
throws IOException
Characters to the provided stream.
text - The CData text to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeCData(char[] data,
int start,
int length,
Writer writer)
throws IOException
Characters to the provided stream.
data - A character array containing the cdata text.start - The starting index into the array.length - The number of characters to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeComment(Comment comment,
Writer writer)
throws IOException
Comment to the provided stream.
comment - The Comment to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeComment(String comment,
Writer writer)
throws IOException
comment - The comment text.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeEntityReference(EntityReference entityRef,
Writer writer)
throws IOException
EntityReference to the provided stream.
entityRef - The EntityReference to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeEntityReference(String entityRef,
Writer writer)
throws IOException
entityRef - The name of the entity reference.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeEntityDeclaration(EntityDeclaration declaration,
Writer writer)
throws IOException
EntityDeclaration to the stream.
declaration - The EntityDeclaration to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEntityDeclaration(String name,
String publicId,
String systemId,
String notation,
Writer writer)
throws IOException
publicId and systemId parameters must be
non-null.
name - The entity name.publicId - The entity public ID, or null.systemId - The entity system ID, or null.notation - The notation name, or null.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEntityDeclaration(String name,
String text,
String notation,
Writer writer)
throws IOException
name - The entity name.text - The entity replacement text.notation - The notation name, or null.writer -
IOException
public static final void writeNotationDeclaration(NotationDeclaration declaration,
Writer writer)
throws IOException
NotationDeclaration to the stream.
declaration - The NotationDeclaration to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeNotationDeclaration(String name,
String publicId,
String systemId,
Writer writer)
throws IOException
publicId and systemId parameters must be
non-null.
name - The notation name.publicId - The entity public ID, or null.systemId - The entity system ID, or null.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeProcessingInstruction(ProcessingInstruction procInst,
Writer writer)
throws IOException
ProcessingInstruction to the provided stream.
procInst - The ProcessingInstruction to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeProcessingInstruction(String target,
String data,
Writer writer)
throws IOException
ProcessingInstruction to the provided stream.
target - The instruction target.data - The instruction data, or null.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
IOException
public static final void writeDTD(DTD dtd,
Writer writer)
throws IOException
DTD to the provided stream.
dtd - The DTD to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeDTD(String dtd,
Writer writer)
throws IOException
dtd - The dtd to write.writer - The destination stream.
IOException - If an error occurs writing to the stream.
public static final void writeEvent(XMLEvent event,
XMLStreamWriter writer)
throws XMLStreamException
XMLStreamWriter. This method
will delegate the actual task of writing to the stream to the appropriate
overloaded method.
event - The event to write.writer - The destination XML stream.
XMLStreamException - If an error occurs writing the event.
public static final void writeStartElement(StartElement start,
boolean empty,
XMLStreamWriter writer)
throws XMLStreamException
StartElement event to the provided stream.
start - The StartElement event to write.empty - Whether the element is empty.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeEndElement(EndElement end,
XMLStreamWriter writer)
throws XMLStreamException
EndElement to the provided stream.
end - The EndElement to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeAttribute(Attribute attr,
XMLStreamWriter writer)
throws XMLStreamException
Attribute to the provided stream.
attr - The Attribute to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeNamespace(Namespace ns,
XMLStreamWriter writer)
throws XMLStreamException
Namespace to the provided stream.
ns - The Namespace to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeStartDocument(StartDocument start,
XMLStreamWriter writer)
throws XMLStreamException
StartDocument to the provided stream.
start - The StartDocument to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeEndDocument(EndDocument end,
XMLStreamWriter writer)
throws XMLStreamException
EndDocument to the provided stream.
end - The EndDocument to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeCharacters(Characters chars,
XMLStreamWriter writer)
throws XMLStreamException
Characters to the provided stream.
chars - The Characters to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeComment(Comment comment,
XMLStreamWriter writer)
throws XMLStreamException
Comment to the provided stream.
comment - The Comment to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeEntityReference(EntityReference entityRef,
XMLStreamWriter writer)
throws XMLStreamException
EntityReference to the provided stream.
entityRef - The EntityReference to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeProcessingInstruction(ProcessingInstruction procInst,
XMLStreamWriter writer)
throws XMLStreamException
ProcessingInstruction to the provided stream.
procInst - The ProcessingInstruction to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
public static final void writeDTD(DTD dtd,
XMLStreamWriter writer)
throws XMLStreamException
DTD to the provided stream.
dtd - The DTD to write.writer - The destination stream.
XMLStreamException - If an error occurs writing to the stream.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||