brunty/relax-ng-domdocument
最新稳定版本:0.2
Composer 安装命令:
composer require brunty/relax-ng-domdocument
包简介
Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings
README 文档
README
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.
Compatibility
- PHP 5.6 and above
Installation
composer require brunty/relax-ng-domdocument
Usage
The class extents \DOMDocument and the method calls are compatible with the parent class.
$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.
$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.
统计信息
- 总下载量: 127
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-18