|
View previous topic :: View next topic
|
| Author |
Message |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
i have a requirement to build some XML with nodes which contain one or more attributes, as well as containing a single value : eg,
<NAME dob="20-05-1988">James</NAME>>
can this be done using XML-GENERATE? |
|
| Back to top |
|
 |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
the actual structure i'm working on looks like :
| Code: |
13 FIELDVALUES.
15 FIELD.
20 NAME PIC X(09) VALUE 'REQUESTID'.
20 FIELD-VAL PIC X(30). |
every formulation of xml-generate I use gives me the following :
| Code: |
<FIELDVALUES>
<FIELD NAME='REQUESTID">
<FIELD-VAL>ABCDE</FIELD-VAL>
</FIELD>
</FIELDVALUES> |
instead of :
| Code: |
<FIELDVALUES>
<FIELD NAME='REQUESTID">
12345
</FIELD>
</FIELDVALUES> |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2264 Location: USA
|
|
|
|
Questions.
1. What is the "formulation of xml-generate"?
2. Where the value "ABCDE", as well as "12345" come from? |
|
| Back to top |
|
 |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
the relevant portion of the XML-GENERATE is :
| Code: |
XML GENERATE XML-OUTPUT
FROM OMEGA
COUNT IN TOTAL-CHAR
NAME COMMUNICATION1 IS "COMMUNICATION"
TYP1 IS "TYPE"
GLOBAL1 IS "GLOBAL"
TYPE ..
NAME IS ATTRIBUTE
|
following a suggestion I read on a technical forum, I tried making field-val indexed as follows :
| Code: |
13 FIELDVALUES.
15 FIELD.
20 NAME PIC X(09).
20 FIELD-VAL OCCURS 1 PIC X(40). |
this had no effect, other than that I had to index all references to FIELD-VAL |
|
| Back to top |
|
 |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
2. Where the value "ABCDE", as well as "12345" come from?
- these are just dummy values I used for illustrative purposes. If FIELD-VAL is set to 'ABCDE', then for my output I want to see :
| Code: |
<FIELDVALUES>
<FIELD NAME='REQUESTID">
ABCDE
</FIELD>
</FIELDVALUES> |
|
|
| Back to top |
|
 |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
looked a bit further and found an answer from google AI :
here's the solution:
| Code: |
13 FIELDVALUES.
15 FIELD.
17 NAME PIC X(09).
17 FIELD-VAL PIC X(40).
...
XML GENERATE XML-OUTPUT
...
FROM OMEGA
COUNT IN TOTAL-CHAR
NAME COMMUNICATION1 IS "COMMUNICATION"
TYP1 IS "TYPE"
GLOBAL1 IS "GLOBAL"
TYPE ...
NAME OF FIELD ATTRIBUTE
FIELD-VAL CONTENT |
sample output:
| Code: |
<FIELDVALUES>
<FIELD NAME="REQUESTID">P747414120999597251107152521976UFLQB</FIELD>
</FIELDVALUES> |
|
|
| Back to top |
|
 |
jzhardy
Active User
Joined: 31 Oct 2006 Posts: 150 Location: brisbane
|
|
|
|
| (it was actually a work colleague that found the answer for me on google AI. ) |
|
| Back to top |
|
 |
|
|