NonStop SOAP 4.1 User's Manual

Example 12 A Sample DDL File with the @SOAP_ATTRIBUTE and @SOAP_ELEMENT Tag
?comments
DEF PATIENT.
02 PATIENT-DATA.
* @SOAP_ATTRIBUTE
03 ID PIC 9(5).
03 AGE PIC 9(3).
* @SOAP_ATTRIBUTE
03 NAME.
04 FIRST PIC X(20).
04 MIDDLE PIC X.
04 LAST PIC X(25).
* @SOAP_ATTRIBUTE
03 HOSPITAL.
04 HOSP-NAME PIC X(30).
* @SOAP_ELEMENT
04 ADDRESS.
05 STREET PIC X(50).
05 CITY PIC X(25).
05 STATE PIC X(2).
05 ZIP PIC 9(5).
04 COUNTY.
* @SOAP_ATTRIBUTE
05 CODE PIC 9(6).
* @SOAP_ELEMENT
05 COUNTY-NAME PIC X(15).
* @SOAP_ATTRIBUTE
05 STATUS PIC X.
* @SOAP_ELEMENT
05 DESCRIPTION PIC X(100).
END
Example 13 shows the XML message and schema representation corresponding to the DDL file.
Example 13 An XML Message for a Sample DDL file with the @SOAP_ATTRIBUTE and
@SOAP_ELEMENT Tag
<patient_data id="12345">
<age>55</age>
<name first="John" middle=" " last="Smith"></name>
<hospital hosp_name="Valley Hospital">
<address>
<street>365 Hospital Dr.</street>
<city>San Jose</city>
<state>CA</state>
<zip>95129</zip>
</address>
<county code="012345" status="L">
<county_name>Santa Clara</county_name>
<description></description>
</county>
</hospital>
</patient_data>
Because the first, middle, and last leaf fields are flagged with the @SOAP_ATTRIBUTE
comment tag in the DDL file, they are represented as XML attribute values for the XML element
<name>. The leaf nodes of the address node are also flagged with the @SOAP_ELEMENT comment
tag in the DDL file and are represented as XML elements.
Table 17 lists the results of the XML representation of a DDL file based on the associated SDL values
and DDL comment tags.
224 NonStop SOAP 4 Features