roettgermann
Member
Hello,
I try to read the following XML-file, but I can't read the nodes 'EANS' and
'KONDITIONEN' .
Can anyone help me?
The file:
<?xml version="1.0" encoding="utf-8"?>
<datareform>
<kopf
kundennummer="9200"
kundenname="Test Kunde"
version="0.0.7.24" />
<artikels>
<artikel
satzid="2127"
bonbezeichnung="Tagescreme grün"
masszahl="50"
einheit="ml"
mwst="2"
status="2"
hersteller="43"
herstellernr="403"
lose="False"
qobest="True"
kassebest="True"
tarakz="False"
pfandkz="False">
<eans>
<ean
nr="4104490004039" />
</eans>
<konditionen>
<kondition
filiale="0"
vk="17.3900"
normvk="17.3900" />
</konditionen>
</artikel>
</artikels>
</datareform>
The code:
create widget-pool.
define variable hDoc as handle.
define variable hRoot as handle.
define variable hTable as handle.
define variable hField as handle.
def var hwert as handle.
define variable hText as handle.
define variable hTTBuffer as handle.
define variable hTTBufferartikel as handle.
define variable hDBField as handle.
define variable nodepointer as integer.
define variable counter as integer.
define temp-table artikel like kassart.
define temp-table Custt like benutzer.
create x-document hDoc.
create x-noderef hRoot.
create x-noderef hTable.
create x-noderef hField.
create x-noderef hText.
hTTBuffer = buffer Custt:handle.
hTTBufferartikel = buffer artikel:handle.
def var TableName as char.
def var htbl as handle.
DEF VAR logvar AS LOG NO-UNDO.
DEF VAR j AS INT NO-UNDO.
DEF VAR k AS INT NO-UNDO.
DEF VAR txt AS CHAR NO-UNDO.
do with frame {&frame-name}:
hDoc:load("file", filename:screen-value, false).
hDoc:get-document-element(hRoot).
repeat nodepointer = 1 to hRoot:num-children:
logvar = hRoot:get-child(hTable,nodepointer).
IF NOT logvar THEN NEXT.
if hTable:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(hTable:attribute-names):
txt = ENTRY(j,hTable:attribute-names).
END.
end.
repeat counter = 1 to hTable:num-children:
logvar = hTable:get-child(hField,counter).
if hfield:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(hfield:attribute-names):
txt = ENTRY(j,hfield:attribute-names).
END.
END.
repeat k = 1 to hfield:num-children:
logvar = hfield:get-child(htext,k).
if htext:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(htext:attribute-names):
txt = ENTRY(j,htext:attribute-names).
END.
end.
END.
end.
END.
end.
With kind regards
Matthias Röttgermann
I try to read the following XML-file, but I can't read the nodes 'EANS' and
'KONDITIONEN' .
Can anyone help me?
The file:
<?xml version="1.0" encoding="utf-8"?>
<datareform>
<kopf
kundennummer="9200"
kundenname="Test Kunde"
version="0.0.7.24" />
<artikels>
<artikel
satzid="2127"
bonbezeichnung="Tagescreme grün"
masszahl="50"
einheit="ml"
mwst="2"
status="2"
hersteller="43"
herstellernr="403"
lose="False"
qobest="True"
kassebest="True"
tarakz="False"
pfandkz="False">
<eans>
<ean
nr="4104490004039" />
</eans>
<konditionen>
<kondition
filiale="0"
vk="17.3900"
normvk="17.3900" />
</konditionen>
</artikel>
</artikels>
</datareform>
The code:
create widget-pool.
define variable hDoc as handle.
define variable hRoot as handle.
define variable hTable as handle.
define variable hField as handle.
def var hwert as handle.
define variable hText as handle.
define variable hTTBuffer as handle.
define variable hTTBufferartikel as handle.
define variable hDBField as handle.
define variable nodepointer as integer.
define variable counter as integer.
define temp-table artikel like kassart.
define temp-table Custt like benutzer.
create x-document hDoc.
create x-noderef hRoot.
create x-noderef hTable.
create x-noderef hField.
create x-noderef hText.
hTTBuffer = buffer Custt:handle.
hTTBufferartikel = buffer artikel:handle.
def var TableName as char.
def var htbl as handle.
DEF VAR logvar AS LOG NO-UNDO.
DEF VAR j AS INT NO-UNDO.
DEF VAR k AS INT NO-UNDO.
DEF VAR txt AS CHAR NO-UNDO.
do with frame {&frame-name}:
hDoc:load("file", filename:screen-value, false).
hDoc:get-document-element(hRoot).
repeat nodepointer = 1 to hRoot:num-children:
logvar = hRoot:get-child(hTable,nodepointer).
IF NOT logvar THEN NEXT.
if hTable:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(hTable:attribute-names):
txt = ENTRY(j,hTable:attribute-names).
END.
end.
repeat counter = 1 to hTable:num-children:
logvar = hTable:get-child(hField,counter).
if hfield:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(hfield:attribute-names):
txt = ENTRY(j,hfield:attribute-names).
END.
END.
repeat k = 1 to hfield:num-children:
logvar = hfield:get-child(htext,k).
if htext:attribute-names <> "" then do:
REPEAT j = 1 TO NUM-ENTRIES(htext:attribute-names):
txt = ENTRY(j,htext:attribute-names).
END.
end.
END.
end.
END.
end.
With kind regards
Matthias Röttgermann