org.xerial.util.xml
Class XMLGenerator
java.lang.Object
org.xerial.util.xml.XMLGenerator
public class XMLGenerator
- extends Object
well-formedなXML文書を生成するためのクラス
[s1](1)
[1][s1]
[s2] (2)
[s3]
[s4]
(1) newline before nested element
(2) newline after leaf element
[1] indent before element (indent string SPACE or TAB, indent character size = 2)
states:
A (the previous output is starg tag)
B (the previous output is text content)
C (the previous output is end tag)
- Author:
- leo
TODO attribute対応
TODO Javadoc
TODO indent on/off
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLGenerator
public XMLGenerator()
XMLGenerator
public XMLGenerator(OutputStream out)
XMLGenerator
public XMLGenerator(Writer out)
text
public XMLGenerator text(String textContent)
startTag
public XMLGenerator startTag(String tagName)
startTag
public XMLGenerator startTag(String tagName,
XMLAttribute attribute)
element
public XMLGenerator element(String tagName,
String textContent)
throws InvalidXMLException
- Throws:
InvalidXMLException
element
public XMLGenerator element(String tagName,
XMLAttribute attribute,
String textContent)
throws InvalidXMLException
- Throws:
InvalidXMLException
selfCloseTag
public XMLGenerator selfCloseTag(String tagName,
XMLAttribute attribute)
throws InvalidXMLException
- Throws:
InvalidXMLException
endTag
public XMLGenerator endTag()
throws InvalidXMLException
- Throws:
InvalidXMLException
flush
public XMLGenerator flush()
endDocument
public void endDocument()
throws InvalidXMLException
- Throws:
InvalidXMLException
setOutputStream
public void setOutputStream(OutputStream out)
setOutputWriter
public void setOutputWriter(Writer writer)
setIndentCharacter
public void setIndentCharacter(XMLGenerator.IndentType indentType,
int length)
- Indentの種類と1レベルあたりの長さを設定する
- Parameters:
indentType - SPACE or TABlength - 1レベルあたりの長さ
indent
protected void indent(int level)
newline
protected void newline()

This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.