A
aza
Guest
I'm using OpenEdge 10.2A.
My XML file has only one TABLE_NAME record and it has many fields but a simplified version is:
<Table_Name>
<Field_Name_1>Value_1</Field_Name_1>
<Field_Name_2>Value_2</Field_Name_2>
</Table_Name>
In order to read it, I use the code:
DEFINE TEMP-TABLE Table_Name NO-UNDO
FIELD Field_Name_1 AS CHAR
FIELD Field_Name_2 AS CHAR
.
TEMP-TABLE Table_Name:READ-XML("File","C:\myFile.xml","empty",?,?,?,?).
DEF VAR i AS INT NO-UNDO.
FOR EACH Table_Name:
i=i + 1.
DISP Field_Name_1 format "x(20)"
Field_Name_2 format "x(20)".
END.
DISP i.
It displays 0 (zero) as the result, meaning it does not read the XML records in the file.
If I change my XML file as follows:
<My_XML_Records>
<Table_Name>
<Field_Name_1>Value_1</Field_Name_1>
<Field_Name_2>Value_2</Field_Name_2>
</Table_Name>
</My_XML_Records>
the same code displays 1 (one)
Since XML files are produced by other programs and the format is fixed, is there a way to make the code to be able to read the XML files?
Continue reading...
My XML file has only one TABLE_NAME record and it has many fields but a simplified version is:
<Table_Name>
<Field_Name_1>Value_1</Field_Name_1>
<Field_Name_2>Value_2</Field_Name_2>
</Table_Name>
In order to read it, I use the code:
DEFINE TEMP-TABLE Table_Name NO-UNDO
FIELD Field_Name_1 AS CHAR
FIELD Field_Name_2 AS CHAR
.
TEMP-TABLE Table_Name:READ-XML("File","C:\myFile.xml","empty",?,?,?,?).
DEF VAR i AS INT NO-UNDO.
FOR EACH Table_Name:
i=i + 1.
DISP Field_Name_1 format "x(20)"
Field_Name_2 format "x(20)".
END.
DISP i.
It displays 0 (zero) as the result, meaning it does not read the XML records in the file.
If I change my XML file as follows:
<My_XML_Records>
<Table_Name>
<Field_Name_1>Value_1</Field_Name_1>
<Field_Name_2>Value_2</Field_Name_2>
</Table_Name>
</My_XML_Records>
the same code displays 1 (one)
Since XML files are produced by other programs and the format is fixed, is there a way to make the code to be able to read the XML files?
Continue reading...