At 08:26 -0500 2006/02/03, Jeffrey Butera wrote:
For the sake of simplicity, we can assume all data fields in the Unidata file are single valued, so the XML structure is very simple - no nested fields, save the outermost ROOT and record tags. The only wrinkle is that the XML field names don't match the Unidata DICT, so I know I'll have to have a mapping.

I need some advice on how to proceed.

A real simple solution is to make a text template of the root XML tags and one for the individual record tags. Just include "place holders" for the data from your file. Then, read-up each record to be exported, use CHANGE() to replace the placeholders with the appropriate field data, accumulate a long string of the record XML and then finally stuff that into the main XML template.

Your record template would look something like:
<record [EMAIL PROTECTED]>
<lastName>{LAST.NAME}</lastName>
...

and then in the code, you'd CHANGE() '[EMAIL PROTECTED]' and '{LAST.NAME}' to the real @ID and the value in the LAST.NAME field.

On the inbound, just strip all excess whitespace and line breaks, convert '><', '>' and '<' to '>@FM<', '>@FM', '@FM<' (respectively, and do '><' first) and then use a LOOP...REMOVE...REPEAT to step through the data to build your records.


Let me know if you need some code snippetts.


I've also seen people make custom DICT entries so that they could just do a LIST/SORT and grab the XML via an EXECUTE ... CAPTURING. Works fine on the outbound, but won't help any on the inbound.


Ray
--
.=================================================================.
| =-=-=-=-=-=-= Eagle Rock Information Systems Corp =-=-=-=-=-=-= |
| -=-=-=-=-=-=- web and database business solutions -=-=-=-=-=-=- |
|   <http://www.eriscorp.com>        <mailto:[EMAIL PROTECTED]>   |
|Midwest Regional Office: 815-547-0662 (voice)  815-547-0353 (Fax)|
.=================================================================.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to