Package apg
Class Utilities.XMLWriter
- java.lang.Object
-
- apg.Utilities.XMLWriter
-
- Enclosing class:
- Utilities
public static class Utilities.XMLWriter extends java.lang.ObjectA 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 voiddeclaration()Generates the XML declaration.voidendTag(int indent, java.lang.String name)Generates an end tag.voidsetOut(java.io.PrintStream out)Sets the output devicevoidstartTag(int indent, java.lang.String name, java.lang.String[] attrs)Generates a start tag.voidtextTag(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.ExceptionGenerates 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.ExceptionGenerates 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)
-
-