Ejemplo nº2: Usar un catálogo para buscar el esquema
En este ejemplo se utiliza un archivo de catálogo para buscar el esquema XML al que hacen referencia los archivos XML que se deben validar.
-----PartBoundary
Content-Disposition: form-data; name="msg"
Content-Type: application/json
{"command": "xsi", "args": ["additional-files:///Primero.xml", "additional-files:///Segundo.xml"], "options": {"user-catalog": "additional-files:///catalog.xml"}}
-----PartBoundary
Content-Disposition: attachment; filename="Primero.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="Segundo.xml"; name="additional-files"
Content-Type: application/octet-stream
<?xml version="1.0" encoding="UTF-8"?>
<test xsi:noNamespaceSchemaLocation="http://ejemplo.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--