2017 © Pedro Peláez
 

library relax-ng-domdocument

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

image

brunty/relax-ng-domdocument

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

  • Friday, January 20, 2017
  • by Brunty
  • Repository
  • 1 Watchers
  • 0 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 13 % Grown

The README.md

Brunty\DOMDocument

Build Status, (*1)

This class is just a little helper to remove error handling when using DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource as by default, PHP warnings are generated when validation fails., (*2)

Compatibility

  • PHP 5.6 and above

Installation

composer require brunty/relax-ng-domdocument, (*3)

Usage

The class extents \DOMDocument and the method calls are compatible with the parent class., (*4)

$document = new \Brunty\DOMDocument;
$document->load('my-file.xml');

$result = $document->relaxNGValidate('my-schema.rng');
// or 
$result = $document->relaxNGValidateSource(file_get_contents('my-schema.rng'));

// $result will be true / false depending on whether the document validated

You can get the warnings that came up during validation by using the getValidationWarnings() method, it'll return an array of the warning messages generated., (*5)

$document = new \Brunty\DOMDocument;
$document->load('my-invalid-file.xml');

$result = $document->relaxNGValidate('my-schema.rng');

$warnings = $document->getValidationWarnings();

Contributing

Although this project is small, openness and inclusivity are taken seriously. To that end the following code of conduct has been adopted., (*6)

Contributor Code of Conduct, (*7)

The Versions

20/01 2017

dev-master

9999999-dev

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

  Sources   Download

MIT

The Development Requires

schema xml validation domdocument relax ng relaxng

20/01 2017

0.2

0.2.0.0

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

  Sources   Download

MIT

The Development Requires

schema xml validation domdocument relax ng relaxng

18/01 2017

0.1

0.1.0.0

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

  Sources   Download

MIT

The Development Requires