Problem with xml and temp-table in OpenEdge.

Posted by rogeliolt on 15-Jul-2015 16:52

Hi friends again me.

I have this XML file:

<data>

      <form id="2" name="Estudio Socioeconomico" submitTo="eguarda-estudio">

            <field1 name="last_name" Label="Last Name"  type="text" Value="Smith"/>

            <field name=First_name" Label="Name" type="text" Value="Henry"/>

            [...]

      </form>

</data>

I load my file with this command:

hDoc:LOAD("file", "(location_file.XML)", FALSE).
hDoc:GET-DOCUMENT-ELEMENT(hRoot).

REPEAT ix = 1 TO hRoot:NUM-CHILDREN:
      hRoot:GET-CHILD(hTable, ix).
       REPEAT jx = 1 TO hTable:NUM-CHILDREN:
             hTable:GET-CHILD(hField, jx).
            

             hDBFld = hBuf:BUFFER-FIELD(hField:NAME).
             hField:GET-CHILD(hText, 1).

             hDBFld:BUFFER-VALUE = hTEXT:NODE-VALUE.
     END.
END.

But I cant save the VALUE data of the xml into a temp-table.

Can u help me please.

Thanks regards.

All Replies

Posted by Dileep Dasa on 16-Jul-2015 02:25

I observe that you are trying to read XML file and put that data into a temp-table. READ-XML() can be handy for this scenario.

Posted by Robin Brown on 16-Jul-2015 07:18

You cannot use READ-XML to load the above document into a temp-table.  READ-XML requires a specific format.  There is an example of reading an XML Document and creating temp-table record in the 'Working with XML' book of our documentation set.  Look at Chapter 2: Reading and Writing XML with the Document Object Model (DOM)

Posted by Robin Brown on 16-Jul-2015 07:22

It looks like you are mainly missing the creation of the temp-table record

Posted by rogeliolt on 20-Jul-2015 10:21

Hi friends.

I used the SAX control to read XML file and create the temp table with the values...

this example helped me with my trouble.

knowledgebase.progress.com/.../P157414

This thread is closed