bitandblack/idml-validator

通过Adobe官方模式验证IDML文件。

支持包维护!
支持我

安装: 67

依赖: 0

建议: 2

安全: 0

1.1.0 2023-12-19 10:25 UTC

This package is auto-updated.

Last update: 2024-09-19 12:03:43 UTC


README

PHP from Packagist Codacy Badge Total Downloads License

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