コンストラクタの概要

XMLParser ()
コンストラクタ。

メソッドの概要

返却値の型 メソッド名
String getErrorMessage ()
エラーメッセージの取得を行います。
Boolean isError ()
エラー発生のチェックを行います。
DOMDocument parseString (String src)
引数で与えられた文字列を XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。
DOMDocument parse (String path)
Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。
DOMDocument parse (File file)
Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。
DOMDocument parse (VirtualFile virtualFile)
Storage 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。
DOMDocument parse (Storage storageObject)
Storage Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

コンストラクタの詳細

XMLParser ()
コンストラクタ。

XMLを解析するパーサーオブジェクトを構築します。

メソッドの詳細

String getErrorMessage ()
エラーメッセージの取得を行います。

XML ソースを解析中にエラーが発生していた場合、そのエラーメッセージを返します。
返却値
String
String エラーメッセージ
Boolean isError ()
エラー発生のチェックを行います。

XML ソースを解析中にエラーが発生していた場合 true を返します。
返却値
Boolean
Boolean true : エラーあり / false : エラーなし
DOMDocument parseString (String src)
引数で与えられた文字列を XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

例えば、以下のようなXML
 <A>
   <B>Bタグの中のテキスト</B>
   <C>Cタグの中のテキスト</C>
 </A>
 
から、<C> タグに囲まれたテキスト値を取得する場合は以下のようにプログラムします。
 
 var xmlString = "<A><B>Bタグの中のテキスト</B><C>Cタグの中のテキスト</C></A>";
 
 var parser = new XMLParser();
 var dom = parser.parseString(xmlString);
 
 if (!parser.isError()) {
     var elms = dom.getElementsByTagName("C");
     var elm = elms[0];
     var childs = elm.getChildNodes();
     var data = childs[0].getValue();
 
     Debug.print("C's text: " + data);
 } else {
     Debug.print("Error occured ! : " + parser.getErrorMessage());
 }
 
パラメータ
src : String
XML形式の文字列
返却値
DOMDocument
DOMDocument DOMDocumentオブジェクト
DOMDocument parse (String path)
Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

パラメータ
path : String
Application Runtime 環境のファイル・パス (Application Runtimeが稼動しているマシン上での絶対パス、または、 Java-VMのシステムプロパティ user.dir で指定されるディレクトリからの相対パス)
返却値
DOMDocument
DOMDocument DOMDocumentオブジェクト
DOMDocument parse (File file)
Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

パラメータ
file : File
ファイル操作オブジェクト
返却値
DOMDocument
DOMDocument DOMDocumentオブジェクト
DOMDocument parse (VirtualFile virtualFile)
Storage 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

互換モジュールがインストールされている場合のみ利用できます。
パラメータ
virtualFile : VirtualFile
VirtualFile操作クラス
返却値
DOMDocument
DOMDocument DOMDocumentオブジェクト @
DOMDocument parse (Storage storageObject)
Storage Application Runtime 環境のファイルコンテンツを XML ドキュメントとして構文解析し、 新しい DOMDocument オブジェクトを返します。

パラメータ
storageObject : Storage
PublicStorage/SystemStorage/SessionScopeStorage操作クラス
返却値
DOMDocument
DOMDocument DOMDocumentオブジェクト