Mr. Grün,

As suggested, I tried the following, and it worked:
return fetch:binary-doc(xs:base64Binary(http:send-request(...)//*:data)

It reduced three calls to two.

IMHO, it is a good idea to add such functionality to the Conversion Module:
convert:base64-to-XML
https://docs.basex.org/wiki/Conversion_Module

Much appreciated.

Regards,
Yitzhak Khabinsky

-----Original Message-----
From: Christian Grün <christian.gr...@gmail.com> 
Sent: Monday, August 15, 2022 2:19 PM
To: Yitzhak Khabinsky <ykhab...@bellsouth.net>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Convert base64 to XML

Thanks. If your data is HTML, html:parse is the correct choice.
fetch:binary-doc can be used to convert a binary item to a document node [1]:

let $b64 := xs:base64Binary(<data>PHgvPg==</data>)
return (
  fetch:binary-doc($b64),
  html:parse($b64)
)

[1] https://docs.basex.org/wiki/Fetch_Module#fetch:binary-doc

Reply via email to