Exemple-2 : Utiliser un catalogue pour trouver le schéma
Dans cet exemple, un fichier de catalogue est utilisé pour trouver le schéma XML qui est référencé par les fichiers XML à valider.
-----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--