2017 © Pedro Peláez
 

library xml-validator

Validates your XML against a xsd schema file.

image

seromenho/xml-validator

Validates your XML against a xsd schema file.

  • Tuesday, August 4, 2015
  • by seromenho
  • Repository
  • 1 Watchers
  • 6 Stars
  • 31,583 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

PHP Xml validator

Build Status Packagist, (*1)

Validate Xml against a xsd schema file., (*2)

Installation

Library

$ git clone https://github.com/seromenho/XmlValidator.git

Composer

$ composer require seromenho/xml-validator:dev-master

Usage

<?php
require "./vendor/autoload.php";
use XmlValidator\XmlValidator;

$xml = "<sample>my xml string</sample>";
$xsd = "path_to_xsd_file.xsd";

// Validate
$xmlValidator = new XmlValidator($xml, $xsd);
try{
    $xmlValidator->validate($xml,$xsd);

    // Check if is valid
    if(!$xmlValidator->isValid()){

        // Do whatever with the errors.
        foreach ($xmlValidator->errors as $error) {
            /*echo sprintf('[%s %s] %s (in %s - line %d, column %d)',
                $error->level, $error->code, $error->message, 
                $error->file, $error->line, $error->column
            ); */
        }
    }
} catch (\InvalidArgumentException $e){
    // catch InvalidArgumentException
}

Based on XmlUtils from Symfony config component., (*3)

The Versions

04/08 2015

dev-master

9999999-dev http://github.com/seromenho/XmlValidator

Validates your XML against a xsd schema file.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

xml xsd psr-4 xml validator

24/06 2015

v1.0

1.0.0.0 http://github.com/seromenho/XmlValidator

Validates your XML against a xsd schema file.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

xml xsd psr-4 xml validator