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

R: Reading XML with &Amp; as part of string



Hallo,

you can try to use "OLD" bif ...

You need to break in two separate operations :

C* Campone is Alfa 78. Search is alfa 10, ii 3,0
C*
C                   eval      campone = 'Num1 & Num2'
C                   eval      search  = '&'
C*
C                   eval      ii = %scan(%trim(search) : campone)
C
C                   if        ii > 0
c                   eval      campone = %replace( '&' :
C                                       %trim(campone) :
C                                       ii : %len(%trim(search)) )
c                   endif


BEFORE

Campone = 'Num1 & Num2'


AFTER :

II = 06
SEARCH = '&     '

Campone = 'Num1 & Num2'


Antonio






-----Messaggio originale-----
Da: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Per conto di Henrik Rützou
Inviato: mercoledì 6 novembre 2013 10:26
A: HTTPAPI and FTPAPI Projects
Oggetto: Re: Reading XML with &Amp; as part of string

myString = 'num1 & num2';

should work

%ScanRpg is a V7R1 feature


On Wed, Nov 6, 2013 at 9:20 AM, <Venter.Derick@xxxxxxxxxxxxxx> wrote:

>    Yes, you're right. It is case sensitive. Thanks. Its not hanging when I
>    use lower case "&amp;" and not "&Amp;"
>    Its now only reading the text after the  "&amp;"  in the string.
>
>    Mystring = 'Num1 &amp; Num2'
>    Only Num2 is returned;
>    Any idea why?
>    Also when i try to use the %ScanRpl('&amp;': '&': MyString); i get the
>    folowing errors in my IBM websphere development studio when compiling:
>    The token is not valid; token is ignored.
>    A right parenthesis is expected but is not found.
>    The end of the expression is expected.
>    Derick Venter
>    Applications Developer IV
>
>    [cid:_4_08CA1EB008CA1AB0002DC91942257C1B]
>
>    Systems Integration
>    Tel: +27 (13) 247 2816 Fax: +27 (0) 86 573 2274
>    Cell: +27 (0) 83 458 6599
>    Email: [1]derick.venter@xxxxxxxxxx
>    [2]www.gijima.com
>    From:        Henrik Rützou <hr@xxxxxxxxxxxx>
>    To:        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>    Date:        2013/11/05 05:17 PM
>    Subject:        Re: Reading XML with &Amp; as part of string
>    Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>
> __________________________________________________________________
>
>    I think that the entities are case sensitive and should be &amp;
>    On Tue, Nov 5, 2013 at 3:30 PM, Raul A. Jager W. <raul@xxxxxxxxxx>
>    wrote:
>    >    %scanrpl('&Amp;': '&': data)
>    >    [1]Venter.Derick@xxxxxxxxxxxxxx wrote:
>    >
>    >    Hi there
>    >    Hope you can help me.
>    >    I am trying to parse an XML document containing the string "&Amp;"
>    >    My program just hangs. The parsing works when I remove the &
>    character.
>    >    The idea is to replace the string "&Amp;" with "&" to get my
>    original
>    >    string back before saving to the database.
>    >    Please help
>    >    Regards
>    >    Derick Venter
>    >    Applications Developer IV
>    >
>    >    [[2][3]cid:_4_0A5D33680A5D2F68004D68ED42257C1A]
>    >
>    >    Systems Integration
>    >    Tel: +27 (13) 247 2816 Fax: +27 (0) 86 573 2274
>    >    Cell: +27 (0) 83 458 6599
>    >    Email: [[3]1]derick.venter@xxxxxxxxxx
>    >    [2][4]www.gijima.com
>    >    From:        Antonio Nalesso [4]<a.nalesso@xxxxxxxxxxx>
>    >    To:        HTTPAPI and FTPAPI Projects [5]<
>    > ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>    >    Date:        2013/11/05 11:28 AM
>    >    Subject:        R: HTTPAPI performance
>    >    Sent by:        [6]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >
>    __________________________________________________________________
>    >
>    >    Thanks a lot,
>    >    I follow your suggestion so now I see in my log (related to WSS
>    DHL for
>    >    label request) :
>    >    2013-11-05-09.50.39.026000 http_persist_open(): entered
>    >                    Login to remote server
>    >    2013-11-05-09.50.41.068000 senddoc(): entered
>    >                    My SOAP request
>    >    2013-11-05-09.50.49.698000 SetError() #13: HTTP/1.1 200 OK
>    >                    Server response
>    >    So I have 2 seconds to login to DHL server and 8 seconds to have a
>    >    reply !!!
>    >    Are these times normal for a WSS service ? I have no idea ...
>    >    Best regards
>    >    Antonio
>    >    PS : I use CRTRPGMOD to rebuild HTTPUTILR4. Then I use UPDSRVPGM
>    to
>    >    update service program, without rebuild it from zero.
>    >    -----Messaggio originale-----
>    >    Da: [7]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    [[3][8][5]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Per conto
>    di Mike
>    >    Krebs
>    >    Inviato: giovedì 31 ottobre 2013 16:40
>    >    A: HTTPAPI and FTPAPI Projects
>    >    Oggetto: RE: HTTPAPI performance
>    >    Earlier this year, I modded my version of the debug log to add
>    >    timestamps to the debug. This catches most of the places that
>    write to
>    >    the debug log but not all, but it will probably give you enough
>    >    information to look at.
>    >    In HTTPUTILR4 you will find the http_dmsg procedure. Add the
>    timestamp
>    >    right in the procedure. Here is one way to do it.
>    >    c                   eval      wwMsg = %char(%timestamp()) + ' ' +
>    >    <===mod
>    >    c                                     %trimr(peMsgTxt) + x'0d25'
>    >    c                   eval      wwMsgLen = %len(%trimr(wwMsg))
>    >    c                   callp     http_xlate(wwMsgLen: wwMsg:
>    TO_ASCII)
>    >    Re-install after making the mod by calling the install program.
>    >    After the change, the debug log looks like this:
>    >    HTTPAPI Ver 1.25beta2 released 2012-03-06
>    >    OS/400 Ver V7R1M0
>    >
>    >    2013-10-31-10.23.19.696000 Setting variables
>    >    2013-10-31-10.23.19.715000 http_url_get(): entered
>    >    2013-10-31-10.23.19.720000 http_persist_open(): entered
>    >    2013-10-31-10.23.19.720000 http_long_ParseURL(): entered
>    >    It should give you plenty of data to look at. By modding
>    http_dmsg, it
>    >    doesn't add timestamps to every message. If you think you have a
>    low
>    >    level problem, you will need to add timestamps in http_dwrite.
>    >    http_dwrite expects ascii so don't forget to do the translation if
>    you
>    >    go to that level. You will see how in the procedure.
>    >    If you are doing "other things" in your code, you might want to
>    add
>    >    your own debug messages. This would help to tell you that your
>    other
>    >    stuff is holding up.
>    >    http_dmsg('Get system control');
>    >    http_dmsg('This is my INCOMING procedure: ' + %trim(name));
>    >    http_dmsg('Writing data to file MIKE');
>    >
>    >    -----Original Message-----
>    >    From: [9]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    [[4][10][6]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf
>    Of
>    > Antonio
>    >    Nalesso
>    >    Sent: Thursday, October 31, 2013 6:30 AM
>    >    To: [11]ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>    >    Subject: HTTPAPI performance
>    >    Hi ,
>    >    I am using HTTPAPI to obtain from DHL WSS labels via web.
>    >    The problem is that I am experiencing very long time on response
>    (media
>    >    11 seconds) and I want to understand where's the problem, that is,
>    if
>    >    it's mine or related to DHL side.
>    >    I put a timestamp before and after the call to "http_url_post_xml"
>    but
>    >    I not able to understand what happens inside (I try to debug
>    HTTPAPIR4
>    >    but I loose myself !!!)
>    >    There is any way to obtain the time of response from remote server
>    ?
>    >    For example : how much time to obtain connection, how much time to
>    >    obtain answer, and so on ....
>    >    I have the debug always *on, but nothing change turning it off.
>    >    PS : I am problem in searching inside FTPAPI archives ... Search
>    give
>    >    me always no results, but ifI go inside the specific month I found
>    it
>    >    !!! Example : I search for 'DHL' : result 0 .
>    >    If I went inside June 2012 I found "Consuming DHL Webservices"
>    that I
>    >    discover via Google !
>    >    Best regards
>    >    Nalesso Antonio
>    >
>    -----------------------------------------------------------------------
>    >    This is the FTPAPI mailing list.  To unsubscribe, please go to:
>    >    [5][12][7]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >
>    -----------------------------------------------------------------------
>    >
>    -----------------------------------------------------------------------
>    >    This is the FTPAPI mailing list.  To unsubscribe, please go to:
>    >    [6][13][8]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >
>    -----------------------------------------------------------------------
>    >
>    __________________________________________________________________
>    >
>    >    This e-mail is subject to the Columbus Stainless [Pty] Ltd Email
>    Legal
>    >    Notices available at:
>    >    [7][14][9]http://www.columbus.co.za/EmailLegalNotice.htm.
>    >
>    __________________________________________________________________
>    >
>    >    This e-mail message has been scanned for Viruses and Content and
>    >    cleared by MailMarshal
>    >
>    __________________________________________________________________
>    >
>    > References
>    >
>    >    1. [15][10]mailto:derick.venter@xxxxxxxxxx
>    >    2. [16][11]http://www.gijima.com/
>    >    3. [17][12]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    4. [18][13]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    5. [19][14]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >    6. [20][15]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >    7. [21][16]http://www.columbus.co.za/EmailLegalNotice.htm
>    >
>    >
>    >
>    _______________________________________________________________________
>    _
>    >
>    >
>    -----------------------------------------------------------------------
>    > This is the FTPAPI mailing list.  To unsubscribe, please go to:
>    > [22][17]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >
>    -----------------------------------------------------------------------
>    >
>    > References
>    >
>    >    1. [18]mailto:Venter.Derick@xxxxxxxxxxxxxx
>    >    2. [19]cid:_4_0A5D33680A5D2F68004D68ED42257C1A
>    >    3. [20]mailto:1]derick.venter@xxxxxxxxxx
>    >    4. [21]mailto:a.nalesso@xxxxxxxxxxx
>    >    5. [22]mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>    >    6. [23]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    7. [24]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    8. [25]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >    9. [26]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >   10. [27]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >   11. [28]mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>    >   12. [29]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >   13. [30]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >   14. [31]http://www.columbus.co.za/EmailLegalNotice.htm
>    >   15. [32]mailto:derick.venter@xxxxxxxxxx
>    >   16. [33]http://www.gijima.com/
>    >   17. [34]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >   18. [35]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    >   19. [36]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >   20. [37]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >   21. [38]http://www.columbus.co.za/EmailLegalNotice.htm
>    >   22. [39]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >
>    >
>    -----------------------------------------------------------------------
>    > This is the FTPAPI mailing list.  To unsubscribe, please go to:
>    > [40]http://www.scottklement.com/mailman/listinfo/ftpapi
>    >
>    -----------------------------------------------------------------------
>    >
>    >
>    --
>    Regards,
>    Henrik Rützou
>    [41]http://powerEXT.com <[42]http://powerext.com/>
>    -----------------------------------------------------------------------
>    This is the FTPAPI mailing list.  To unsubscribe, please go to:
>    [43]http://www.scottklement.com/mailman/listinfo/ftpapi
>    -----------------------------------------------------------------------
>
> __________________________________________________________________
>
>    This e-mail is subject to the Columbus Stainless [Pty] Ltd Email Legal
>    Notices available at:
>    [44]http://www.columbus.co.za/EmailLegalNotice.htm.
>
> __________________________________________________________________
>
>    This e-mail message has been scanned for Viruses and Content and
>    cleared by MailMarshal
>
> __________________________________________________________________
>
> References
>
>    1. mailto:derick.venter@xxxxxxxxxx
>    2. http://www.gijima.com/
>    3. cid:_4_0A5D33680A5D2F68004D68ED42257C1A
>    4. file://localhost/tmp/www.gijima.com
>    5. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    6. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>    7. http://www.scottklement.com/mailman/listinfo/ftpapi
>    8. http://www.scottklement.com/mailman/listinfo/ftpapi
>    9. http://www.columbus.co.za/EmailLegalNotice.htm
>   10. mailto:derick.venter@xxxxxxxxxx
>   11. http://www.gijima.com/
>   12. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   13. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   14. http://www.scottklement.com/mailman/listinfo/ftpapi
>   15. http://www.scottklement.com/mailman/listinfo/ftpapi
>   16. http://www.columbus.co.za/EmailLegalNotice.htm
>   17. http://www.scottklement.com/mailman/listinfo/ftpapi
>   18. mailto:Venter.Derick@xxxxxxxxxxxxxx
>   19. cid:_4_0A5D33680A5D2F68004D68ED42257C1A
>   20. mailto:1
>   21. mailto:a.nalesso@xxxxxxxxxxx
>   22. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>   23. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   24. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   25. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   26. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   27. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   28. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>   29. http://www.scottklement.com/mailman/listinfo/ftpapi
>   30. http://www.scottklement.com/mailman/listinfo/ftpapi
>   31. http://www.columbus.co.za/EmailLegalNotice.htm
>   32. mailto:derick.venter@xxxxxxxxxx
>   33. http://www.gijima.com/
>   34. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   35. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>   36. http://www.scottklement.com/mailman/listinfo/ftpapi
>   37. http://www.scottklement.com/mailman/listinfo/ftpapi
>   38. http://www.columbus.co.za/EmailLegalNotice.htm
>   39. http://www.scottklement.com/mailman/listinfo/ftpapi
>   40. http://www.scottklement.com/mailman/listinfo/ftpapi
>   41. http://powerext.com/
>   42. http://powerext.com/
>   43. http://www.scottklement.com/mailman/listinfo/ftpapi
>   44. http://www.columbus.co.za/EmailLegalNotice.htm
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -
>
>


--
Regards,
Henrik Rützou

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