Re: Extracting an xml file from a zip behind basic auth

Hi David,

You should be able to store the Zip file using <p:store 
cx:decode="true"> (if you use XML Calabash) and then use pxp:unzip on 
the stored file.

Only in XProc 3 will you be able to let the zip flow through the 
pipeline without writing anything to disk.

Gerrit

On 14.04.2023 20:26, David Cramer wrote:
> Hi all,
> 
> I have a nice XProc 1.0 script that interacts with a REST API behind 
> basic auth. I provide base64 encoded credentials and the pipeline 
> happily parses the xml response bodies, follows link relations, 
> recursively follows pagination links, constructs its own request bodies 
> to POST and so on. Everything is great except for one awkward part: The 
> API provides access to zip files containing a bundle of resources, 
> including some XML files that I need. I was hoping I could use pxp:unzip 
> providing the url of the zip, but I have provide the authentication 
> header as well. Should I use p:http-request and send the result of that 
> to pxp:unzip? Unfortunately p:http-request doesn't seem to like hitting 
> an endpoint that gives it non-xml content. What's the right approach? Is 
> there an example of how to do this?
> 
> For now, I've just done p:exec to call curl, get the zip on the 
> filesystem, and pxp:unzip it from there, but it seems so inelegant 
> compared to everything else.
> 
> Regards,
> 
> David
> 
> 

Received on Friday, 14 April 2023 20:06:57 UTC