1

We are trying to decode the encoded string in xquery. I didnt know how to decode the string.

Following is the xquery. this basically converts xml to json and we should also need to do the decoding.

    declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option jsoniq-version "0.4.42"; 
declare option output:method "json"; 
        {  
                "Data":{                     
                          "Text" : string(/Request/EncodedText),
                      }                  
           } 

how to do the decoding in this xquery.

Ghislain Fourny
  • 6,971
  • 1
  • 30
  • 37
mnvbrtn
  • 558
  • 1
  • 8
  • 27
  • Which XQuery processor are you using? – wst Sep 02 '14 at 14:31
  • We are using IBM datapower appliance. – mnvbrtn Sep 02 '14 at 14:44
  • What would you decode the Base64 too? Typically Base64 is used to hold a binary value which cannot be represented as a string. – adamretter Sep 02 '14 at 14:47
  • Base64 is often used to hold strings in UTF8 encoding (e.g. in LDAP). But you need to know the encoding. The new EXPath binary module has methods to do that, but it's probably not implemented for your chosen XQuery engine. – Michael Kay Sep 02 '14 at 14:59
  • Hope this work for you:
    https://stackoverflow.com/questions/69923037/decode-base64-to-string-and-encode-string-to-base64-in-xquery
    –  Nov 11 '21 at 04:35

0 Answers0