-2

I'm getting values in xquery but they are in HEX so I would like to know if there any function to convert a particular value from hex to ascii in xquery.

  • Simple answer: No. You have to write your own or use a library which offers this functionality. – dirkk Apr 09 '16 at 10:34
  • 1
    What exactly do you mean by "ascii"? Ascii is a mapping between characters and integers, how do you convert hex to a mapping? I guess you mean you want to take a hex string, convert it into a sequence of integers, and return the character string whose ASCII codepoints correspond to those integers? – Michael Kay Apr 09 '16 at 19:57
  • Yes Michael. I want a function to convert hex string and return ASCII form of it – Radha Krishna Apr 19 '16 at 22:18

1 Answers1

1

If your implementation supports the EXPath-binary library (see http://expath.org/spec/binary), then you can do

bin:decode-string(bin:hex($input)) 
Michael Kay
  • 156,231
  • 11
  • 92
  • 164