ottosmops/xmlvalidator
Composer 安装命令:
composer require ottosmops/xmlvalidator
包简介
Validate XML-Files, also parts
README 文档
README
This package was developed to validate Mets files for the DFG-Viewer. It is possible to validate only parts of a xml-file. Validation is possible with xsd, rng and xsl (Schematron). To validate only parts of an XML file, specify the root element of that part. In the tests folder is a copy of dmj/dfgviewer-schema.
Installation
composer require ottosmops/xmlvalidator
Usage
There is the one and only method validate:
<?php require('vendor/autoload.php'); use Ottosmops\XmlValidator\XmlValidator; class test { public static function index() { $option = ['file' => 'tests/data/valid/mets_001.xml', 'ns' => 'mets', 'nsuri' => 'https://www.loc.gov/METS/', 'root' => 'mets', 'schema' => 'https://www.loc.gov/standards/mets/mets.xsd']; $validator = new XmlValidator($option); if (!$validator->validate()) { print("validated mets: is not valid".PHP_EOL); print($validator->getErrors()); } else { print("validated mets: is valid".PHP_EOL); } } } test::index();
You can find more examples in the tests folder.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 144
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-10-07