7. ASOLib—OpenROAD Server Library : XML Parameters for Use with GSCPs : How You Can Retrieve XML from a GSCP
 
Share this page                  
How You Can Retrieve XML from a GSCP
If you want the returned parameter data to be in XML format, specify a string variable named b_so_xml in the by-reference PDO. In the example, the client VB code would look like this:
Set byrefPDO = CreateObject("OpenROAD.ParameterData")
byrefPDO.DeclareAttribute "b_so_xml", "STRING"
After the GSCP is called, string variable b_so_xml will contain an XML document generated from the 4GL method's parameter names and values. The XML returned will contain a DTD detailing the structure of the XML. It will not contain an XML processing instruction as the first line; this is deliberate and allows the client to more easily specify any XSLT transformations.
Sample Output:
Sample output from the scp_GetAuthorAndBooks call follows:
<!DOCTYPE scp_getauthorandbooks [
   <!ELEMENT   scp_getauthorandbooks  (p_i_author_id*, b_UCAuthor*,
      b_arr_UCBooks*)>
    <!ELEMENT   p_i_author_id  (#PCDATA)>
    <!ELEMENT   b_UCAuthor  (i_age, i_id, v_name)>
    <!ELEMENT   i_age  (#PCDATA)>
    <!ELEMENT   i_id  (#PCDATA)>
    <!ELEMENT   v_name  (#PCDATA)>
    <!ELEMENT   b_arr_UCBooks  (arr_ucedition*, v_title, ucauthor?)>
    <!ELEMENT   arr_ucedition  (i_issue_no, i_year, m_cost, ucpublisher?)>
    <!ELEMENT   i_issue_no  (#PCDATA)>
    <!ELEMENT   i_year  (#PCDATA)>
    <!ELEMENT   m_cost  (#PCDATA)>
    <!ELEMENT   ucpublisher  (v_name)>
    <!ELEMENT   v_title  (#PCDATA)>
    <!ELEMENT   ucauthor  (i_age, i_id, v_name)>
]>
 <scp_getauthorandbooks>
    <p_i_author_id>101</p_i_author_id>
    <b_UCAuthor>
        <i_age>23</i_age>
        <i_id>101</i_id>
        <v_name>P.S.Eudonym</v_name>
    </b_UCAuthor>
    <b_arr_UCBooks>
        <arr_ucedition>
            <i_issue_no>1</i_issue_no>
            <i_year>1990</i_year>
            <m_cost>               $5.99</m_cost>
            <ucpublisher>
                <v_name>Raven &amp; Wolf Publishing</v_name>
            </ucpublisher>
        </arr_ucedition>
        <v_title>Horror Stories</v_title>
        <ucauthor>
            <i_age>23</i_age>
            <i_id>101</i_id>
            <v_name>P.S.Eudonym</v_name>
        </ucauthor>
    </b_arr_UCBooks>
    <b_arr_UCBooks>
        <arr_ucedition>
            <i_issue_no>1</i_issue_no>
            <i_year>1991</i_year>
            <m_cost>               $5.99</m_cost>
            <ucpublisher>
                <v_name>Raven &amp; Wolf Publishing</v_name>
            </ucpublisher>
        </arr_ucedition>
        <arr_ucedition>
            <i_issue_no>2</i_issue_no>
            <i_year>1994</i_year>
            <m_cost>               $6.99</m_cost>
            <ucpublisher>
                <v_name>Raven &amp; Wolf Publishing</v_name>
            </ucpublisher>
        </arr_ucedition>
        <v_title>More Horror Stories</v_title>
        <ucauthor>
            <i_age>23</i_age>
            <i_id>101</i_id>
            <v_name>P.S.Eudonym</v_name>
        </ucauthor>
    </b_arr_UCBooks>
</scp_getauthorandbooks>