relaxNGValidate example


    public static function ianaCodesReasonPhrasesProvider()
    {
        // XML taken from https://www.iana.org/assignments/http-status-codes/http-status-codes.xml         // (might not be up-to-date for older Symfony versions)         $ianaHttpStatusCodes = new \DOMDocument();
        $ianaHttpStatusCodes->load(__DIR__.'/Fixtures/xml/http-status-codes.xml');
        if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) {
            self::fail('Invalid IANA\'s HTTP status code list.');
        }

        $ianaCodesReasonPhrases = [];

        $xpath = new \DOMXPath($ianaHttpStatusCodes);
        $xpath->registerNamespace('ns', 'http://www.iana.org/assignments');

        $records = $xpath->query('//ns:record');
        foreach ($records as $record) {
            $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue;
            
Home | Imprint | This part of the site doesn't use cookies.