Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

%XML.TextReader の実行

%XML.TextReaderOpens in a new tab クラスを使用した一例を見てみましょう。この例は XML ドキュメントを読み取り、全 XML 要素を現在のデバイスに出力します。

—%XML.TextReader の使用—
%XML.TextReader の使用
ClassMethod ShowElements(filename As %String)
{
    // Create an instance of %XML.TextReader (returned by reference)
    Set sc = ##class(%XML.TextReader).ParseFile(filename,.reader)

    If ($$$ISOK(sc)) {
        // Read all elements within the document
        While (reader.Read()) {
            If (reader.NodeType = "element") {
                Write reader.Name,!
            }
        }
    }
}

この例をもう少し詳しく見てみましょう。

FeedbackOpens in a new tab