[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_url_get_xml



Jürgen,

"name= value" is not part of the element name. Given the "SEG_ELM" element, "name" is an attribute of the element and "#GGOH_SEGMENT_VERSION#" is the value of the attribute. You can access the attribute names and their values via the attrs array. attrs is an array of pointers. The first pointer points to the name of the first attribute. The second pointer points to the value of the first attribute. The third pointer points to the name of the second attribute and the fourth pointer points to the value of the second attribute. A NULL pointer indicates the end of the list. Example:

attrs(1)  = name of the 1. attribute
attrs(2)  = value of the 1. attribute
attrs(3)  = name of the 2. attribute
attrs(4)  = value of the 2. attribute
...
attrs(x)  = *NULL = end of  list

This is how you can spin through the list of attributes and their associated values:

  // Spin through attributes of element <ID>
  x = 1;
  dow (attrs(x) <> *NULL and x <= %elem(attrs));
     attr_name = %str(attrs(x));

     select;
     when (attr_name = 'schemeID');
        tns_Customer.ID_schemeID = %str(attrs(x+1));
     when (attr_name = 'schemeAgencyID');
        tns_Customer.ID_schemeAgencyID = %str(attrs(x+1));
     when (attr_name = 'schemeAgencySchemeID');
        tns_Customer.ID_schemeAgencySchemeID = %str(attrs(x+1));
     when (attr_name = 'schemeAgencySchemeAgencyID');
        tns_Customer.ID_schemeAgencySchemeAgencyID = %str(attrs(x+1));
     endsl;

     x = x + 2;
  enddo;

Thomas.


Jürgen Seifert schrieb:
Hello,
i am connecting to a web-service using your tools

       rc = http_url_get_xml(%trim(postdata)
                             : %paddr(StartOfElement)
                             : %paddr(EndOfElement)
                             : *NULL);

Everything is fine, only the XML parser gives not the result i want.

     P                 E
     P EndOfElement    B
     D EndOfElement    PI
     D   UserData                      *   value
     D   depth                       10I 0 value
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)

The fields depth, path and value are ok
only the field name gives me the first part, like "SESSIONVAR" or SEG_ELM"

how do i get the parser to give me the name= value?

This is the answer from the server:

<?xml version="1.0" encoding="ISO-8859-1"?>
<RESULT>
<SESSION>
<SESSIONVAR type="DATE">Wed, 15 Apr 2009</SESSIONVAR>
<SESSIONVAR type="TIME">16:02:00:000</SESSIONVAR>
<SESSIONVAR type="LANGUAGE">de</SESSIONVAR>
<SESSIONVAR type="PAYLOADID">XML 127.0.0.1 160200000</SESSIONVAR>
<SESSIONVAR type="PRODID">008</SESSIONVAR>
</SESSION>
<SUMMARY_DATA/>
<ENQUIRY>
<SEGMENT identifier="GGOH" priority="1">
<SEG_ELM name="#GGOH_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGOH_ERROR_TYPE#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGOH_MESSAGE_CODE#" len="3" type="N">000</SEG_ELM>
<SEG_ELM name="#GGOH_REQUEST_REFERENCE_NO#" len="9" type="C">ANTRAG001</SEG_ELM>
<SEG_ELM name="#GGOH_RESPONSE_REFERENCE_NO#" len="18" type="C">P 181 000015688678</SEG_ELM>
</SEGMENT>
<SEGMENT identifier="GGDE" priority="10">
<SEG_ELM name="#GGDE_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGDE_GENERATION_ID1#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGDE_DELPHI_SCORE1#" len="5" type="N">00894</SEG_ELM>

<SEG_ELM name="#GGDE_GENERATION_ID2#" len="2" type="N">02</SEG_ELM>
<SEG_ELM name="#GGDE_DELPHI_SCORE2#" len="5" type="N">00002</SEG_ELM>
<SEG_ELM name="#GGDE_GENERATION_ID3#" len="2" type="N">03</SEG_ELM>
<SEG_ELM name="#GGDE_DELPHI_SCORE3#" len="5" type="N">00000</SEG_ELM>
</SEGMENT>
<SEGMENT identifier="GGSS" priority="14">
<SEG_ELM name="#GGSS_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGSS_APPLICATION_REFERENCE_NO#" len="9" type="C">ANTRAG001</SEG_ELM>
<SEG_ELM name="#GGSS_CAPS#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_CAIS#" len="1" type="C">0</SEG_ELM>

<SEG_ELM name="#GGSS_TEL#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_COURT#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_FAS#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_COLLECTION#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_ADDRESSLINKS#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_GEODATA#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_DIRECTORS#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_ACCOUNT_IN_ARREARS#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_BLOCKING_RECORD#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGSS_CONSUMER_COMMENT#" len="1" type="C"> </SEG_ELM>
</SEGMENT>
<SEGMENT identifier="GGAV" priority="12">
<SEG_ELM name="#GGAV_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGAV_RETURN_CODE#" len="26" type="C" code_value="00">Eingabeadresse ist korrekt</SEG_ELM>
<INDEXED_SEGMENTS>
<CHILD_SEGMENT identifier="GGAP">
<SEG_ELM name="#GGAP_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGAP_REASON_FOR_APPLICANT_DATA_RETURN#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#NUMBEROF_CHILD_ENTRIES#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGAP_SEGMENT_ID#" len="4" type="C">GGAF</SEG_ELM>
<SEG_ELM name="#GGAP_SEGMENT_NO#" len="1" type="N">1</SEG_ELM>
<SEG_ELM name="#GGAP_SEGMENT_START_INDEX#" len="3" type="N">001</SEG_ELM>
</CHILD_SEGMENT>
<CHILD_SEGMENT identifier="GGAF">
<SEG_ELM name="#GGAF_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
<SEG_ELM name="#GGAF_ADDRESS_INDICATOR#" len="1" type="C">0</SEG_ELM>
<SEG_ELM name="#GGAF_ADDRESS_FROM_DATE#" len="8" type="D">99999999</SEG_ELM>
<SEG_ELM name="#GGAF_ADDRESS_TO_DATE#" len="8" type="D">99999999</SEG_ELM>
<SEG_ELM name="#GGAF_STREET_NO#" len="2" type="C">33</SEG_ELM>
<SEG_ELM name="#GGAF_STREET_NAME#" len="21" type="C">Werner-Warsinsky-Str.</SEG_ELM>
<SEG_ELM name="#GGAF_TOWN#" len="5" type="C">Lünen</SEG_ELM>
<SEG_ELM name="#GGAF_POSTCODE#" len="5" type="C">44534</SEG_ELM>
</CHILD_SEGMENT>
</INDEXED_SEGMENTS>
</SEGMENT>
<SEGMENT identifier="GGOE" priority="17">
<SEG_ELM name="#GGOE_SEGMENT_VERSION#" len="2" type="N">01</SEG_ELM>
</SEGMENT>
</ENQUIRY>
</RESULT>




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------