bitandblack / idml-validator
通过Adobe官方模式验证IDML文件。
1.1.0
2023-12-19 10:25 UTC
Requires
- php: >=7.4
- ext-dom: *
- ext-libxml: *
- ext-zip: *
- bitandblack/composer-helper: ^0.4 || ^1.0
- bitandblack/pathinfo: ^1.0
- bitandblack/unzip: ^0
- psr/log: ^1.0 || ^2.0 || ^3.0
- symfony/console: ^5.0 || ^6.0 || ^7.0
- symfony/string: ^5.0 || ^6.0 || ^7.0
Requires (Dev)
- monolog/monolog: ^2.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^10.0
- rector/rector: ^0
- symplify/easy-coding-standard: ^12.0
Suggests
- bitandblack/idml-creator: The full version of the IDML-Creator. This library can be used with Private Packagist.
- bitandblack/idml-creator-demo: Creates IDML content natively. This is a demo library.
- bitandblack/idml-writer: Writes IDML files.
This package is auto-updated.
Last update: 2024-09-19 12:03:43 UTC
README
IDML验证器
通过Adobe官方模式验证IDML文件。
安装
此库是为与Composer一起使用而制作的。通过运行$ composer require bitandblack/idml-validator将其添加到您的项目中。
使用方法
IDML验证器主要用于CLI。尽管如此,它也可以集成到PHP项目中。
通过CLI执行验证
运行$ php vendor/bin/idml-validator validate /path/to/file.idml以验证您的IDML文件。
这将打印类似以下内容
Found 3 errors:
┌──────┬───────────────────────── designmap.xml ────────────────────────────────┐
│ Line │ Message │
├──────┼────────────────────────────────────────────────────────────────────────┤
│ 3 │ Element 'Document', attribute 'DOMVersion': [facet 'enumeration'] The │
│ │ value '14.0' is not an element of the set {'8.0'}. │
├──────┼────────────────────────────────────────────────────────────────────────┤
│ 3 │ Element 'Document', attribute 'DOMVersion': '14.0' is not a valid valu │
│ │ e of the local atomic type. │
├──────┼────────────────────────────────────────────────────────────────────────┤
│ 23 │ Element 'EndnoteOption': This element is not expected. Expected is one │
│ │ of ( TextVariable, {http://ns.adobe.com/AdobeInDesign/idml/1.0/packagi │
│ │ ng}Tags, Layer, {http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging} │
│ │ MasterSpread, {http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging}Sp │
│ │ read, Section, DocumentUser, CrossReferenceFormat, Index, {http://ns.a │
│ │ dobe.com/AdobeInDesign/idml/1.0/packaging}BackingStory ). │
└──────┴────────────────────────────────────────────────────────────────────────┘
自定义
对于验证器的集成使用,请使用Validation类,给它一个文件和模式
<?php
use IDML\Validator\File;
use IDML\Validator\Schema;
use IDML\Validator\Validation;
$validation = new Validation(
new File('/path/to/file.idml'),
new Schema()
);
$validation->validate();
$errors = $validation->getErrors();
一个问题
一个巨大的问题是Adobe自从InDesign CS6以来没有更新模式。因此,每个新功能都会导致错误,即使它是官方允许的。我们正在与Adobe联系,并等待他们的答复。所以请小心错误,当你认为一个功能是可能的但抛出错误时,不要在意。
帮助
如果您有任何问题,请通过hello@bitandblack.com与我们联系。
有关Bit&Black的更多信息,请访问www.bitandblack.com。