Example-2: Using a Catalog to Find the Schema
In this example, a catalog file is used to find the XML schema that is referenced by the XML files to be validated.
-----PartBoundary
Content-Disposition: form-data; name="msg"
Content-Type: application/json
{"command": "xsi", "args": ["additional-files:///First.xml", "additional-files:///Second.xml"], "options": {"user-catalog": "additional-files:///catalog.xml"}}
-----PartBoundary
Content-Disposition: attachment; filename="First.xml"; name="additional-files"
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8"?>
<test xsi:noNamespaceSchemaLocation="http://example.com/Demo.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">42</test>
-----PartBoundary
Content-Disposition: attachment; filename="Second.xml"; name="additional-files"
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8"?>
<test xsi:noNamespaceSchemaLocation="http://example.com/Demo.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">35</test>
-----PartBoundary
Content-Disposition: attachment; filename="Demo.xsd"; name="additional-files"
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="test" type="xs:int"/>
</xs:schema>
-----PartBoundary
Content-Disposition: attachment; filename="catalog.xml"; name="additional-files"
Content-Type: application/octet-stream
<?xml version='1.0' encoding='UTF-8'?>
<catalog xmlns='urn:oasis:names:tc:entity:xmlns:xml:catalog' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='urn:oasis:names:tc:entity:xmlns:xml:catalog Catalog.xsd'>
<uri name="http://example.com/Demo.xsd" uri="additional-files:///Demo.xsd"/>
</catalog>
-----PartBoundary--