invoso.com Report post Posted 11/27/2013 03:18 PM I try to create tracking script. answer from source server looks like this: <?xml version="1.0" encoding="UTF-8"?><Odpowiedz> <Wyniki> <DaneTrackingowe> <Przesylka> <NumerPrzesylki>830224172</NumerPrzesylki> <Status>Magazyn nadający</Status> <DataNadania>2013-11-25 11:55:54</DataNadania> <DataDoreczenia></DataDoreczenia> <HistoriaLista> <Historia> <Data>2013-11-25</Data> <Godzina>10:45:40</Godzina> <Status>Wprowadzona</Status> <Komentarz>Wprowadzona do systemu i oczekuje na przyjazd kuriera</Komentarz> <DaneDodatkowe></DaneDodatkowe> <Oddzial>Warszawa</Oddzial> </Historia> <Historia> <Data>2013-11-25</Data> <Godzina>11:55:54</Godzina> <Status>Przyjęta</Status> <Komentarz>Przyjęta przez kuriera w miejscu nadania</Komentarz> <DaneDodatkowe>dddd</DaneDodatkowe> <Oddzial>Warszawa</Oddzial> </Historia> <Historia> <Data>2013-11-25</Data> <Godzina>12:01:43</Godzina> <Status>Magazyn nadający</Status> <Komentarz>Przesyłka została wprowadzona na magazyn nadający</Komentarz> <DaneDodatkowe></DaneDodatkowe> <Oddzial>Warszawa</Oddzial> </Historia> </HistoriaLista> </Przesylka> </DaneTrackingowe> </Wyniki></Odpowiedz> In VG logs I see: 153747.417 22 49 17 rv add kex_http_resp_hdr_Connection|close153747.417 22 49 17 rv add kex_http_resp_hdr_Content-Type|text/html153747.417 22 49 17 rv add kex_http_resp_hdr_Date|Wed, 27 Nov 2013 14:38:01 GMT153747.418 22 49 17 rv add kex_http_resp_hdr_Server|IdeaWebServer/v0.80153747.418 22 49 17 rv add NumerPrzesylki|830224172153747.418 22 49 17 rv add NumerPrzesylki_1|830224172153747.418 22 49 17 rv add Status|Magazyn nadający153747.418 22 49 17 rv add Status_1|Magazyn nadający153747.418 22 49 17 rv add DataNadania|2013-11-25 11:55:54153747.419 22 49 17 rv add DataNadania_1|2013-11-25 11:55:54153747.419 22 49 17 rv add Data|2013-11-25153747.419 22 49 17 rv add Data_1|2013-11-25153747.419 22 49 17 rv add Godzina|10:45:40153747.419 22 49 17 rv add Godzina_1|10:45:40153747.419 22 49 17 rv add Status_2|Wprowadzona153747.421 22 49 17 rv add Komentarz|Wprowadzona do systemu i oczekuje na przyjazd kuriera153747.421 22 49 17 rv add Komentarz_1|Wprowadzona do systemu i oczekuje na przyjazd kuriera153747.421 22 49 17 rv add Oddzial|Warszawa153747.421 22 49 17 rv add Oddzial_1|Warszawa153747.422 22 49 17 rv add Data_2|2013-11-25153747.422 22 49 17 rv add Godzina_2|11:55:54153747.422 22 49 17 rv add Status_3|Przyjęta153747.422 22 49 17 rv add Komentarz_2|Przyjęta przez kuriera w miejscu nadania153747.422 22 49 17 rv add DaneDodatkowe|dddd153747.422 22 49 17 rv add DaneDodatkowe_1|dddd153747.422 22 49 17 rv add Oddzial_2|Warszawa153747.423 22 49 17 rv add Data_3|2013-11-25153747.423 22 49 17 rv add Godzina_3|12:01:43153747.423 22 49 17 rv add Status_4|Magazyn nadający153747.423 22 49 17 rv add Komentarz_3|Przesyłka została wprowadzona na magazyn nadający153747.423 22 49 17 rv add Oddzial_3|Warszawa153747.423 22 49 17 rv add kex_Result_Code|OK153747.424 22 49 17 rv add kex_Result_Desc|OK How to recognize data like last <Historia>...</Historia> content? I can't change or customize source data. I need to read (tts) each Historia (history) record, but for example variable Status in history 3rd listed data has number Status_4 because on top is current Status as Status_1 How to count how many elements (or max value) including data? eg. max Status_X value? Share this post Link to post
SupportTeam Report post Posted 11/27/2013 07:47 PM Looks like you are using a Web Service module ( http://www.voiceguide.com/vghelp/source/html/modws.htm ) to issue a http message, and the quoted XML is the response sent back to VoiceGuide. correct? You can see in the 'created $RVs' trace that all entries within each of the <Historia> sections are extracted and added as separate $RVs. To use the correct Status entries you would need to use a counter that starts at 2. Or pass the entire response to your own parser (called using Run Program or Run Script modules) Max Status_X value could be ascertained by checking if the $RV contains a value.(eg. check if length of data contained in $RV is 0) If it does not contain any data then you can assume there is no more data. Share this post Link to post
invoso.com Report post Posted 11/27/2013 08:32 PM I know basic web service module functionality, but I need to be prepared to different counts of Historia sections or other and after downloading webpage easy to find searched data. Tracking include several data in xml tree so we need to sort and order data so question is how to find data? maybe other names of variables in WS including xml tags tree structure? <Historia_1_Data>2013-11-25</Historia_1_Data> <Historia_1_Godzina>10:45:40</Historia_1_Godzina><Historia_1_Status>Wprowadzona</Historia_1_Status> <Historia_1_Komentarz>Wprowadzona do systemu i oczekuje na przyjazd kuriera</Historia_1_Komentarz><Historia_1_DaneDodatkowe></Historia_1_DaneDodatkowe><Historia_1_Oddzial>Warszawa</Historia_1_Oddzial> I'm looking for a system solution for reading xml data. Share this post Link to post
SupportTeam Report post Posted 11/27/2013 09:10 PM The approach outlined before (checking whether $RV contains any data) should meet your requirements. Any more complex parsing would require custom scripting/programming. We can assist in creating these if needed. If you would require custom modules or programs/scripts please contact sales@voiceguide.com with your requirements. NB. If $RV names were to include the XML path and include array indices then this would result in $RV in this case looking like this: $RV[Odpowiedz_Wyniki_DaneTrackingowe_Przesylka_HistoriaLista_Historia_1_Data] and/or like this: $RV[Odpowiedz_1_Wyniki_1_DaneTrackingowe_1_Przesylka_1_HistoriaLista_1_Historia_1_Data] this is why a simpler approach of just using end element name as $RV name was used to simplify the use of $RVs later on. Share this post Link to post