# [NTG-context] Processing XML file inside a zip file

Henri Menke henrimenke at gmail.com
Fri Jan 11 04:57:41 CET 2019

```On 11/01/19 4:42 PM, Aditya Mahajan wrote:
> Hi,
>
> Is it possible to process an XML file inside a zip file without unzipping?
>
> In particular, I have a program that generates zip files which look like
> this:
>
> The file `filename.zip` contains:
> - filename.xml - file_hash1.png
> - file_hash2.png
> etc.
>
> Where `filename.xml` (the name matches the basename of the zip file) is
> the main xml file and the `file_hash1.png` etc are png files that are
> referred to inside the xml file.
>
> If I unzip the file and add
>
> \setupexternalfigures[directory={path-to-unzipped-folder]
>
> then, I have an \startxmlsetups .. \stopxmlsetups environment that
> correctly typesets the xml file. I believe that I have seen Hans post
> snippets of code that suggest that context can directly read from a zip
> file. So, I am wondering if there is a way that I can just call
>
> context --magic-flags filename.zip

You can directly typeset ePub files which is just zipped XML.  There is
a script in mtxrun for it:

context --ctx=x-epub.ctx yourfile.epub

>
> and obtain the correct output.
>
> Thanks,
> ___________________________________________________________________________________
>