4D v16.3

XML DECODE

ホーム

 
4D v16.3
XML
XML DECODE

XML DECODE 


 

XML DECODE ( xmlValue ; 4Dvar ) 
引数   説明
xmlValue  テキスト in XML構造から取得したテキスト型の値
4Dvar  フィールド, 変数 in 変換したXMLの値を受け取る4D変数またはフィールド

説明   

XML DECODE コマンドはXML文字列に格納されている値を4D型の値に変換します。 変換は以下のルールに基づいて自動で行われます:    

日本語システム上での変換例
数値<Price>8,5</Price><Price>8.5</Price>実数: 8.5
ブール<Double>1</Double> <Double>0</Double> または<Double>true</Double> <Double>false</Double>ブール: True/False
BLOBBase64 デコード
ピクチャBase64 デコード + BLOB to picture コマンド
日付2009-10-25T01:03:20+01:00時間部とタイムゾーンを取り除く: !10/25/2009!
時間2009-10-25T01:03:20+01:00日付部を取り除く: ?01:03:20?  警告:タイムゾーンは、ローカル時間と異なる場合にのみ使用されます。例: "2009-10-25T01:03:20+05:00" は、UTC+1のローカル時間では、?21:03:20? とデコードされます

例題  

XMLドキュメントから、属性として格納されているデータを読み込む。
XMLドキュメントの例:

<CD  Date="2003-01-01T00:00:00Z" Description="This double CD reissued by EMI  in 1995 combines 
4 Stabat mater hymns. One by Rossini interpreted by the  Berlin Symphony Orchestra, directed by Karl Forster. 
Followed by a work  of Verdi, by the Philharmonic Orchestra, directed by Carlo Maria  Giulini. On the second CD, 
you will find Francis Poulenc interpreted by  Régine Crespin. This compilation ends with a little-known version, that  of the Polish composer Karol Szymanowski. Polish National Radio Symphony  Orchestra directed by Antoni Wit" 
Double="true" 
Duration="7246"  
Type="Sacred music" 
CD_ID="5" 
Performer="Various" 
Price="8.5" 
Title="4  Stabat mater"/>

 Repeat
    MyEvent:=SAX Get XML node(DocRef)
 
    Case of
       :(MyEvent=XML Start Element)
          ARRAY TEXT(arrAttrNames;0)
          ARRAY TEXT(arrAttrValues;0)
          SAX GET XML ELEMENT(DocRef;vName;vPrefix;arrAttrNames;arrAttrValues)
          If(vName="CD")
             CREATE RECORD([CD])
             For($i;1;Size of array(arrAttrNames))
                $attrName:=arrAttrNames{$i}
                Case of
                   :($attrName="CD_ID")
                      XML DECODE(arrAttrValues{$i};[CD]CD_ID)
                   :($attrName="Title")
                      [CD]Work:=arrAttrValues{$i}
                   :($attrName="Price")
                      XML DECODE(arrAttrValues{$i};[CD]Price)
                   :($attrName="Date")
                      XML DECODE(arrAttrValues{$i};[CD]Date entered)
                   :($attrName="Duration")
                      XML DECODE(arrAttrValues{$i};[CD]Total_duration)
                   :($attrName="Double")
                      XML DECODE(arrAttrValues{$i};[CD]Double_CD)
                End case
             End for
          End if
          ...
    End case
 Until(MyEvent=XML End Document)



参照 

BASE64 DECODE
BASE64 ENCODE

 
プロパティ 

プロダクト: 4D
テーマ: XML
番号: 1091

This command can be run in preemptive processes

 
履歴 

初出: 4D v12

 
ARTICLE USAGE

ランゲージリファレンス ( 4D v16)
ランゲージリファレンス ( 4D v16.1)
ランゲージリファレンス ( 4D v16.2)
ランゲージリファレンス ( 4D v16.3)