java.lang.Object └ DocumentUtil
Documentに関するユーティリティクラス
コンストラクタの概要 | |
DocumentUtil()
|
メソッドの概要 | |
static org.w3c.dom.Node |
clean(org.w3c.dom.Node node)
NodeからTAB文字で始まるテキストノードを再帰的に削除する。 |
static java.lang.String |
Document2String(org.w3c.dom.Document document)
XMLドキュメントを文字列に変換する。 |
static org.w3c.dom.Document |
readDocument(java.io.File xmlfile)
XMLファイルを読み込み、Documentオブジェクトを返す |
static org.w3c.dom.Document |
readDocument(java.lang.String xmlfilename)
XMLファイルを読み込み、Documentオブジェクトを返す |
static org.w3c.dom.Document |
String2Document(java.lang.String str)
文字列をXMLドキュメント化する。 |
static void |
writeDocument(java.io.File xmlfile,
org.w3c.dom.Document document)
Documentから、XMLファイルを書き出す。 |
static void |
writeDocument(java.io.File xmlfile,
org.w3c.dom.Document document,
java.lang.String encoding)
Documentから、XMLファイルを書き出す。 |
static void |
writeDocument(java.lang.String xmlfile,
org.w3c.dom.Document document)
Documentから、XMLファイルを書き出す。 |
static void |
writeDocument(java.lang.String xmlfilename,
org.w3c.dom.Document document,
java.lang.String encoding)
Documentから、XMLファイルを書き出す。 |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
コンストラクタの詳細 |
public DocumentUtil()
メソッドの詳細 |
public static java.lang.String Document2String(org.w3c.dom.Document document) throws java.io.UnsupportedEncodingException, javax.xml.transform.TransformerException, javax.xml.transform.TransformerFactoryConfigurationError
document
- XMLドキュメント
java.io.UnsupportedEncodingException
javax.xml.transform.TransformerException
javax.xml.transform.TransformerFactoryConfigurationError
public static org.w3c.dom.Document String2Document(java.lang.String str) throws javax.xml.parsers.ParserConfigurationException, javax.xml.parsers.FactoryConfigurationError, java.io.IOException, org.xml.sax.SAXException
str
- 文字列
javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.FactoryConfigurationError
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document readDocument(java.io.File xmlfile) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
xmlfile
- XMLファイル
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public static org.w3c.dom.Document readDocument(java.lang.String xmlfilename) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
xmlfilename
- XMLファイル名
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public static void writeDocument(java.io.File xmlfile, org.w3c.dom.Document document, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
xmlfile
- XMLファイルdocument
- Documentオブジェクトencoding
- 文字コード
java.io.FileNotFoundException
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public static void writeDocument(java.lang.String xmlfilename, org.w3c.dom.Document document, java.lang.String encoding) throws java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
xmlfilename
- XMLファイル名document
- Documentオブジェクトencoding
- 文字コード
java.io.FileNotFoundException
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public static void writeDocument(java.io.File xmlfile, org.w3c.dom.Document document) throws java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
xmlfile
- XMLファイルdocument
- Documentオブジェクト
java.io.FileNotFoundException
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public static void writeDocument(java.lang.String xmlfile, org.w3c.dom.Document document) throws java.io.FileNotFoundException, java.io.IOException, javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
xmlfile
- XMLファイルdocument
- Documentオブジェクト
java.io.FileNotFoundException
java.io.IOException
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public static org.w3c.dom.Node clean(org.w3c.dom.Node node)
NodeからTAB文字で始まるテキストノードを再帰的に削除する。
※ このメソッド適応後にファイル出力すると、 TABおよびスペース文字によるインデントがなくなってしまうことに注意。
node
- ノードツリー