Dies ist die alte 4D Dokumentations-Website. Die neue und aktualisierte Dokumentation finden Sie unter developer.4d.com

Home

 
4D v20 R7
XML
XML DECODE

XML DECODE 


 

XML DECODE ( xmlWert ; 4Dvar ) 
Parameter Typ   Beschreibung
xmlWert  Text in Wert vom Typ Text, der aus einer XML Struktur stammt
4Dvar  Feld, Variable in 4D Variable oder Feld für Empfang der konvertierten XML Werte

Der Befehl XML DECODE konvertiert einen Wert, gespeichert als ein XML String, in einen Wert vom Typ 4D. Die Konvertierung wird automatisch nach folgenden Regeln ausgeführt:   

WertBeispieleKonvertierung in englischem System
Zahl<Preis>8,5</Preis><Preis>8.5</Preis>Zahl: 8.5
Boolean<Doppel>1</Doppel> <Doppel>0</Doppel>Boolean: True/False
oder <Doppel>true</Doppel> <Doppel>false</Doppel>
BLOBBase64 Decodierung
BildBase64 Decodierung + BLOB zu Bildbefehl
Datum2009-10-25T01:03:20+01:00Löschen des Zeitteils und der Zeitzone: !25.10.2009!
Zeit2009-10-25T01:03:20+01:00Löschen des Datumteils Warnung: Zeitzone wird berücksichtigt, wenn unterschiedlich zur lokalen Zeit. Beispiel: "2009-10-25T01:03:20+05:00" ergibt ?21:03:20? in lokaler Zeit UTC+1

Ist der Parametertyp 4Dvar nicht definiert, wird standardmäßig der Typ Text verwendet. 

Daten aus einem XML Dokument importieren, in dem Werte als Attribute gespeichert sind.
Beispiel für XML Dokument:

<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="Titel")
                      [CD]Work:=arrAttrValues{$i}
                   :($attrName="Preis")
                      XML DECODE(arrAttrValues{$i};[CD]Price)
                   :($attrName="Datum")
                      XML DECODE(arrAttrValues{$i};[CD]Date entered)
                   :($attrName="Dauer")
                      XML DECODE(arrAttrValues{$i};[CD]Total_duration)
                   :($attrName="Doppel")
                      XML DECODE(arrAttrValues{$i};[CD]Double_CD)
                End case
             End for
          End if
          ...
    End case
 Until(MyEvent=XML End Document)



Siehe auch 

BASE64 DECODE
BASE64 ENCODE

 
EIGENSCHAFTEN 

Produkt: 4D
Thema: XML
Nummer: 1091

Dieser Befehl kann in preemptive Prozessen laufen

 
SEITENINHALT 
 
GESCHICHTE 

Erstellt: 4D v12

 
ARTIKELVERWENDUNG

4D Programmiersprache ( 4D v20 R7)