Read XML Response which includes all text, image and videos

Home Forums Convertigo developers Forums as moved to Stack Overflow. Read XML Response which includes all text, image and videos

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #133290

    RItesh K
    Participant

    Hi All

    In my SOAP request i am getting the XML Response correctly, in which one field is “Description” which is a textarea filed which contain text, images or videos

    <Description>Phone with a display.<br/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAB4CAIAAACmSi0cAAAgAElEQVR4nOy8dXQU2br3v8vaNYK7DAzuJMAAwSH44K4hEO90Ok4IcU93lIR40u7dSfDBXUI8ODF8mJlzzp17znl/7/n9sbs7HWOGuXPlXetmfVetpqiurno++5G9a+8Cq5Y7rFrusGLZ7OVLZy1f6rB8qcOy5Y7LljsuXDRz8VKHRUscZ86eMGhoHyoDozIIG3sGg4PQ2YDGAgwOYNkgHDuMbYuzbDC2LQ4/sGwwJhe1EtajGDa4RXTbDrFsTGLbEhw7EhTXnmzZadnPtSdz7clwT3fBMzNtCaYtwbQnMe1JrD5kVp9ej+9NluvpIgYH7VE0FuhRdDbSs1hYjwJLF01fumj6Yqdpi52mLVk0c+niWUuWzl66zMF5zcI16xatWu3kOHfKwCH2OBmgBKCzCAiGzgYMDmDbohw7jGNHQCrWbKzwfAUYhtn0XahYwFhj+7Lh6FwMCp6fYUcw7Ajm1xv6awFQmV8pBtKjwMrlDlCrVjiuXDXPefX81WsWrFm7cMkyx+Ur5y1d8d1Mh4n9BtpgJICRAJNDZnIxBgdhcBAmF2Xb4hw7AoKxfLBmw7LBejVEL7JurRY2HDtSB9HfZzgqG6FxUIs6OH2loXsThfEnid6zwKKFU50WTHFaMGXBwikLFk5b6DR9odN0p0UzFjjNWLzUYdHSOdNnje830IagADINs7FnsGxwJhftAoZlg/1ZYLo4lnWLtri/ddvs1XDdRGUjVPN3/+Mt/T8dzOIlMxYtnu60aMb8hdO+WzB13vwpUE6LZy1aMnu+06zJ08b0HcDFyQAnAxaXwuKSYLNlcjHYqNm2OJOLdgksvUUwi+i9qZdY3MWClhvrzXDkXvTVoeYrwfxZ4MH8BZPnLZg0Z94khzkTZjmMmzFr7PSZY6bPHDN23OCx4waPHjt48DB7JoeKEgAnAwabxOKSYONlcFAzA5TBQSwwrONDrxmPjVB7Uy8335tdejUcqxMPEsOkrzXQ1xr6a0NibwL9BzL7DmTY96fZ9qVw7UmWiGQKu0yUykAICoLggETBmBwqk0NmsHEaE6WzTH4Dj7Qm8ftbyhdatDUVMv03MPRmIAue3wTTmwf8WR721WBg7QuvjEzvEIODUhiAoAASFcCSDCchVAbB5JDpLIzGRGnMDreg</Description>

    I want to convert this code to image or video while showing it in Mobile.
    I am sure we need to use writebase64 step in my sequence. But i am not sure how to use this.

    Currently i have linked the step writebase64 step to (@Description/text()) by using source picker.And give the property “Output file” as the location where I need this output.

    How to do these following.
    1. How to get the output locally
    2. How to link the output image from that location to my listed data. I may have multiple images liked to many objects in mobile.

    Need to understand overall process by some example or steps

    Thanks!

    Any help on this, greatly appreciated

    #133291

    admin
    Keymaster

    Hello seems you have here a good output here.

    The writebase64 step will decode as base64 the source and write the content to disk on the server. This is not what you need here.
    Your sequence is already returning data to the mobile device. On the client side, you just need to use CTF to place each field in the correct place :

    
    <textarea >__=Description__</textarea>
    <img data-c8o-use="on" data-c8o-use-src="__=img[src]__" />
    

    This will result having the textarea filled with description content and a img tag with the src attribute filled with the data:image/png;base64xxxxx….xxx inline image stuf

    Hope That Helps

    • This reply was modified 5 years, 5 months ago by admin.
    #133296

    RItesh K
    Participant

    I tried this but it not working for me. I think in above code some problem with image tag.
    Is there any documentation available for C80 image?

    I tried this below image tag then also it is not working

      <li>__=Description__</li>
    <img data-c8o-use="on" data-c8o-use-src="__=img[src]__" />__=Description__ </img>
    

    Please help me out here….

    Regards
    Ritesh

    • This reply was modified 5 years, 5 months ago by RItesh K.
    • This reply was modified 5 years, 5 months ago by RItesh K.
    • This reply was modified 5 years, 5 months ago by RItesh K.
    #133303

    Gregory Vorbe
    Moderator

    Hello Ritesh,

    I would recommend you to use a Sequence to properly format the XML output response for the CTF, for example:

    |__ Sequences
        |__ mySequence
            |__ Steps
                |__ Call_Transaction
                |__ Complex_Result
                    |__ Element_Description //document/transaction/document/Description/text()[1]
                    |__ Element_img
                        |__ Attribute @src //document/transaction/document/Description/img/@src

    The output would be something like this:

    <document>
        <Result>
            <Description>Phone with a display.</Description>
            <Img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAAB4CAIAAACmSi0cAAAgAElEQVR4nOy8dXQU2br3v8vaNYK7DAzuJMAAwSH44K4hEO90Ok4IcU93lIR40u7dSfDBXUI8ODF8mJlzzp17znl/7/n9sbs7HWOGuXPlXetmfVetpqiurno++5G9a+8Cq5Y7rFrusGLZ7OVLZy1f6rB8qcOy5Y7LljsuXDRz8VKHRUscZ86eMGhoHyoDozIIG3sGg4PQ2YDGAgwOYNkgHDuMbYuzbDC2LQ4/sGwwJhe1EtajGDa4RXTbDrFsTGLbEhw7EhTXnmzZadnPtSdz7clwT3fBMzNtCaYtwbQnMe1JrD5kVp9ej+9NluvpIgYH7VE0FuhRdDbSs1hYjwJLF01fumj6Yqdpi52mLVk0c+niWUuWzl66zMF5zcI16xatWu3kOHfKwCH2OBmgBKCzCAiGzgYMDmDbohw7jGNHQCrWbKzwfAUYhtn0XahYwFhj+7Lh6FwMCp6fYUcw7Ajm1xv6awFQmV8pBtKjwMrlDlCrVjiuXDXPefX81WsWrFm7cMkyx+Ur5y1d8d1Mh4n9BtpgJICRAJNDZnIxBgdhcBAmF2Xb4hw7AoKxfLBmw7LBejVEL7JurRY2HDtSB9HfZzgqG6FxUIs6OH2loXsThfEnid6zwKKFU50WTHFaMGXBwikLFk5b6DR9odN0p0UzFjjNWLzUYdHSOdNnje830IagADINs7FnsGxwJhftAoZlg/1ZYLo4lnWLtri/ddvs1XDdRGUjVPN3/+Mt/T8dzOIlMxYtnu60aMb8hdO+WzB13vwpUE6LZy1aMnu+06zJ08b0HcDFyQAnAxaXwuKSYLNlcjHYqNm2OJOLdgksvUUwi+i9qZdY3MWClhvrzXDkXvTVoeYrwfxZ4MH8BZPnLZg0Z94khzkTZjmMmzFr7PSZY6bPHDN23OCx4waPHjt48DB7JoeKEgAnAwabxOKSYONlcFAzA5TBQSwwrONDrxmPjVB7Uy8335tdejUcqxMPEsOkrzXQ1xr6a0NibwL9BzL7DmTY96fZ9qVw7UmWiGQKu0yUykAICoLggETBmBwqk0NmsHEaE6WzTH4Dj7Qm8ftbyhdatDUVMv03MPRmIAue3wTTmwf8WR721WBg7QuvjEzvEIODUhiAoAASFcCSDCchVAbB5JDpLIzGRGnMDreg"/>
        </Result>
    </document>

    Your HTML page with CTF:

    <div>
    	<form name="frm" data-c8o-call=".mySequence">
    		<input type="submit" value="OK">
    	</form>
    </div>
    <div id="result" data-c8o-listen=".mySequence">
    	<textarea data-c8o-if="Description">__=Description__</textarea>
    	<br/>
    	<img data-c8o-use="on" data-c8o-use-src='__{"find": "Img", "attr": "src"}__'>
    </div>

    Support&QA

    • This reply was modified 5 years, 5 months ago by Gregory Vorbe.
    Attachments:
    You must be logged in to view attached files.
    #134303

    RItesh K
    Participant

    Hi

    Thanks for reply

    But i have hard time in converting/splitting my Description in two tags/elements

    In my XML output , Description tag itself i have : Text+Image+Video

    <Description>Phone with a display.<br/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</Description>

    How i will break down my text and images in two XML tags(elements) by sequence.
    In your above explanation , you suggested to split text and images in two different elements

    Thanks

    #134311

    Gregory Vorbe
    Moderator

    Hello Ritesh,

    In the ascii treeview of my example project of my previous post, I put the Xpath to split your nested XML into two tags:

    Create an XML Element step whose Node name property is “Description” and Source property is something like //document/transaction/document/Description/text()[1] from your Call_Transaction step that returns the complete XML response. Do the same for the img tag, create it manually and add an Attribute step whose Node name property is “src” and Source property is //document/transaction/document/Description/img/@src
    The same goes with your video tag, it will be empty if it does not exist or you can use a IfExist Step to create it only if it exists in your original XML Description tag.

    Support&QA

    #143321

    RItesh K
    Participant

    Hello Gregory

    I have tried your above quoted steps multiple times in different stages but till date i am not successful.
    It will be very helpful if you can provide me the example .car file if you have any

    Thanks!

    Regards
    Ritesh

    #143327

    Gregory Vorbe
    Moderator

    Hello Ritesh,

    Here is the project car file I made to answer you in previous posts and make screen shots.
    This is a 7.3.2 project version. For Convertigo versions below that you can temporarly uncheck ‘Product version check’ in ‘Main parameters’ configuration to successfully import it (Convertigo Studio > Window > Preferences > Convertigo > Engine > Main parameters or in Web admin console).

    Edit: rename .txt to .car
    Edit: to test project call http://localhost:18080/convertigo/projects/C8OForum133290/index.html

    Support&QA

    • This reply was modified 5 years, 4 months ago by Gregory Vorbe.
    Attachments:
    You must be logged in to view attached files.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.