PHP code example of turnerlabs / validating-xml-encoder

1. Go to this page and download the library: Download turnerlabs/validating-xml-encoder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

turnerlabs / validating-xml-encoder example snippets




$encoder = new \TurnerLabs\ValidatingXmlEncoder\Encoder('rootNodeName', $pathToXsd));
// If the encoded result of $data is not valid according to the XSD,
// \TurnerLabs\ValidatingXmlEncoder\Exception\XsdValidationException is thrown.
$xml = $encoder->encode($data);