brunty/relax-ng-domdocument 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

Build Status

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.

Contributor Code of Conduct

统计信息

  • 总下载量: 127
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-18