Turning XSD into documentation file

This XSD stuff is not for me, f*cking unreadable :/ Thanks god there is a stylesheet that makes it prettier, like a documentation.
First download it http://www.w3.org/2008/09/xsd.xsl due browser cross domain restriction, so you can avoid (fastest solution for me now)

Unsafe attempt to load URL https://www.w3.org/2008/09/xsd.xsl from frame with URL http://localhost/kovoinox/temp/stock.xsd. Domains, protocols and ports must match.

After download put it next to the XSD file and insert the following line as the 2nd row in the XSD:

<?xml version="1.0" encoding="Windows-1250"?>
<?xml-stylesheet type="text/xsl" href="xsd.xsl"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 ... the rest of the XSD ...

After opening the XSD in the browser you get a much nicer interpretation.


Solution from http://stackoverflow.com/questions/6686124/how-to-turn-xsd-files-into-documentation-file

Solving No matching global declaration available for the validation root.

Had to create a custom XML for Pohoda accounting software, but hit some errors so I decided to make a PHPUnit test for validating it against its XML schema definition (XSD) with PHPs DOMDocument::schemaValidate

/** @test */
public function validateStockXml()
$xml = new \DOMDocument();

$isValid = $xml->schemaValidate('http://www.stormware.cz/schema/version_2/stock.xsd');

Stuck with the following error for a couple of hours 😦

Element ‘{http://www.stormware.cz/schema/version_2/data.xsd}dataPack’: No matching global declaration available for the validation root.

After a lot of trial and error decided to google more and more I finally found the solution at http://www.scriptscoop.me/t/81762e7e42e7/php-xml-validation-no-matching-global-declaration-available-for-the-valida.html

Changing the schema URL to http://www.stormware.cz/schema/version_2/data.xsd instead using http://www.stormware.cz/schema/version_2/stock.xsd solved the problem.

So easy, huh 🙂 Always learning.