org.xerial.util.xml
Class XMLGenerator

java.lang.Object
  extended by 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

Nested Class Summary
static class XMLGenerator.FormatStab
           
static class XMLGenerator.IndentType
           
 
Constructor Summary
XMLGenerator()
           
XMLGenerator(OutputStream out)
           
XMLGenerator(Writer out)
           
 
Method Summary
 XMLGenerator element(String tagName, String textContent)
           
 XMLGenerator element(String tagName, XMLAttribute attribute, String textContent)
           
 void endDocument()
           
 XMLGenerator endTag()
           
 XMLGenerator flush()
           
protected  void indent(int level)
           
protected  void newline()
           
 XMLGenerator selfCloseTag(String tagName, XMLAttribute attribute)
           
 void setIndentCharacter(XMLGenerator.IndentType indentType, int length)
          Indentの種類と1レベルあたりの長さを設定する
 void setOutputStream(OutputStream out)
           
 void setOutputWriter(Writer writer)
           
 XMLGenerator startTag(String tagName)
           
 XMLGenerator startTag(String tagName, XMLAttribute attribute)
           
 XMLGenerator text(String textContent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLGenerator

public XMLGenerator()

XMLGenerator

public XMLGenerator(OutputStream out)

XMLGenerator

public XMLGenerator(Writer out)
Method Detail

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 TAB
length - 1レベルあたりの長さ

indent

protected void indent(int level)

newline

protected void newline()


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