Example-3: Using ZIP Archives
ZIP archives can also be uploaded, and files within a ZIP can be referenced by using the additional-files scheme. For example:
additional-files:///mybigarchive.zip%7Czip/biginstance.xml
Note: | The |zip/ part needs to be URI-escaped as %7Czip/ in order to conform to the URI RFC since the pipe | symbol is not directly allowed. The use of glob patterns (* and ?) is also allowed. So you can use something like this to validate all XML files within the ZIP archive: {“command”: “xsi”, “args”: [“additional-files:///mybigarchive.zip%7Czip/*.xml”], “options”: {…}} |
Note: | 'Content-Disposition: form-data' is also valid, in addition to 'Content-Disposition: attachment'. Since several tools generate form-data as content-disposition, the value form-data is accepted as valid. |
In this example, it is assumed that all schema references are relative paths and that all schemas are contained within the zip.
-----PartBoundary Content-Disposition: form-data; name="msg" Content-Type: application/json
{"command": "xsi", "args": ["additional-files:///Demo.zip%7Czip/*.xml"], "options": {}}
-----PartBoundary Content-Disposition: attachment; filename="Demo.zip"; name="additional-files" Content-Type: application/octet-stream
Binary content of Demo.zip archive
-----PartBoundary-- |
In this example, the XML files in a ZIP archive are validated using references to an external schema, which is provided in a second ZIP archive.
-----PartBoundary Content-Disposition: form-data; name="msg" Content-Type: application/json
{"command": "xsi", "args": ["additional-files:///Instances.zip%7Czip/*.xml"], "options": {"user-catalog": "additional-files:///Schemas.zip%7Czip/catalog.xml"}}
-----PartBoundary Content-Disposition: attachment; filename="Instances.zip"; name="additional-files" Content-Type: application/octet-stream
Binary content of Instances.zip archive
-----PartBoundary Content-Disposition: attachment; filename="Schemas.zip"; name="additional-files" Content-Type: application/octet-stream
Binary content of Schemas.zip archive
-----PartBoundary-- |