Package apg
Class Utilities.XMLWriter
- java.lang.Object
-
- apg.Utilities.XMLWriter
-
- Enclosing class:
- Utilities
public static class Utilities.XMLWriter extends java.lang.Object
A class for assisting in the writing of XML files. This is an assistant only. Generating a complete and valid XML file is the user's responsibility.
-
-
Constructor Summary
Constructors Constructor Description XMLWriter(java.io.PrintStream out)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
declaration()
Generates the XML declaration.void
endTag(int indent, java.lang.String name)
Generates an end tag.void
setOut(java.io.PrintStream out)
Sets the output devicevoid
startTag(int indent, java.lang.String name, java.lang.String[] attrs)
Generates a start tag.void
textTag(int indent, java.lang.String name, java.lang.String[] attrs, java.lang.String text)
Generates a start and end tag pair with text between them.
-
-
-
Method Detail
-
setOut
public void setOut(java.io.PrintStream out)
Sets the output device- Parameters:
out
- the output device.
-
declaration
public void declaration()
Generates the XML declaration. Version 1.0, UTF-8 encoding only.
-
startTag
public void startTag(int indent, java.lang.String name, java.lang.String[] attrs) throws java.lang.Exception
Generates a start tag.- Parameters:
indent
- the number of spaces to indent before printing the line.name
- tag nameattrs
- the attributes as name/value pairs of Strings. May be null or an array of zero length if no attributes are to be included in the start tag.- Throws:
java.lang.Exception
- thrown if the non-null or non-empty array of attributes does not have an even number of members (name/value pairs)
-
endTag
public void endTag(int indent, java.lang.String name)
Generates an end tag.- Parameters:
indent
- the number of spaces to indent before printing the line.name
- tag name
-
textTag
public void textTag(int indent, java.lang.String name, java.lang.String[] attrs, java.lang.String text) throws java.lang.Exception
Generates a start and end tag pair with text between them.- Parameters:
indent
- the number of spaces to indent before printing the line.name
- tag nameattrs
- the attributes as name/value pairs of Strings. May be null or an array of zero length if no attributes are to be included in the start tag.text
- the text to include between the start and end tags.- Throws:
java.lang.Exception
- thrown if the non-null or non-empty array of attributes does not have an even number of members (name/value pairs)
-
-