Hi,
I've been testing the new READ-XML method features in Progress 10.1A that allows one to read an XML file into a temp-table versus using the sax parse method.
Basically I just setup a simple procedure based of information from the Progress knowledge base. Created a preset xml, run my procedure to read the xml file and simply output values doing a for each on the temp table. Obviously Im missing something because the temp table doesnt seem to get populated. Any help appreciated. You can try testing my proc by putting it and the xml file in the same directory and run it from the command line.
This is posted in webspeed area because I will eventually be parsing an xml file received via a returned POST using WEB-CONTEXT:X-DOCUMENT. Also, maybe this all can be helpful for the dozens of other folks trying to get better info on utilizing these features. These same features would be used if you were to populate a prodataset.
Code below:
And a very simple example of the xml file being loaded
I've been testing the new READ-XML method features in Progress 10.1A that allows one to read an XML file into a temp-table versus using the sax parse method.
Basically I just setup a simple procedure based of information from the Progress knowledge base. Created a preset xml, run my procedure to read the xml file and simply output values doing a for each on the temp table. Obviously Im missing something because the temp table doesnt seem to get populated. Any help appreciated. You can try testing my proc by putting it and the xml file in the same directory and run it from the command line.
This is posted in webspeed area because I will eventually be parsing an xml file received via a returned POST using WEB-CONTEXT:X-DOCUMENT. Also, maybe this all can be helpful for the dozens of other folks trying to get better info on utilizing these features. These same features would be used if you were to populate a prodataset.
Code below:
Code:
def temp-table tt-item
field item-number as char
field upc as char
field username as char
field password as char.
def var v-return-mode as log no-undo.
def var v-sourcetype as char no-undo.
def var v-read-xml as char no-undo.
def var v-read-xml-path as char no-undo.
def var v-readmode as char no-undo.
def var v-schemapath as char no-undo.
def var v-override-def-map as log no-undo.
def var v-field-type-map as char no-undo.
def var v-verify-schema-mode as char no-undo.
def var v-test_xml as char no-undo.
/* assign values for read type definitions */
assign v-sourcetype = "FILE"
v-read-xml = "myitem.xml"
v-read-xml-path = "xml/" + v-read-xml
v-readmode = "EMPTY"
v-schemapath = ?
v-override-def-map = ?
v-field-type-map = ?
v-verify-schema-mode = ?.
/********************************************************************/
/* we read in the xml file and create our temp table. We assign our */
/* v-return-mode true or false if any records are read from the xml */
/********************************************************************/
v-return-mode =
TEMP-TABLE tt-item:READ-XML(v-sourcetype, v-read-xml-path , v-readmode,
v-schemapath, v-override-def-map,
v-field-type-map, v-verify-schema-mode).
/* Now we read through our temp table records */
if v-return-mode then
do:
for each tt-item:
display tt-item.item-number.
end.
end.
else
display "failed". /* test output */
return.
And a very simple example of the xml file being loaded
<?xml version="1.0" encoding="ISO-8859-1"?>
<CATALOG>
<ITEM>
<USERNAME>test</USERNAME>
<PASSWORD>test1</PASSWORD>
<ITEMNO>BB55667Y</ITEMNO>
</ITEM>
<ITEM>
<USERNAME>test</USERNAME>
<PASSWORD>test2</PASSWORD>
<ITEMNO>CC55667Y</ITEMNO>
</ITEM>
<ITEM>
<USERNAME>test</USERNAME>
<PASSWORD>test3</PASSWORD>
<ITEMNO>DD55667Y</ITEMNO>
</ITEM>
</CATALOG>