citation-generator/doi2jats
最新稳定版本:v1.0.0
Composer 安装命令:
composer require citation-generator/doi2jats
包简介
Generate JATS XML citations from DOIs
README 文档
README
CLI for generating JATS XML citations from DOIs using multiple academic data providers.
Basic Usage (Single DOI)
php doi2jats.php <DOI>
Example:
php doi2jats.php 10.30430/gjae.2023.0350
Multiple DOIs
php doi2jats.php <DOI1> <DOI2> <DOI3> ...
Example:
php doi2jats.php 10.30430/gjae.2023.0350 10.52825/bis.v1i.42
Advanced Options
# Verbose output with processing details php doi2jats.php -v 10.30430/gjae.2023.0350 10.52825/bis.v1i.42 # Ref-List format (all citations in ref-list) php doi2jats.php -f reflist 10.30430/gjae.2023.0350 10.52825/bis.v1i.42 # Back format with numbering php doi2jats.php --format back 10.30430/gjae.2023.0350 10.52825/bis.v1i.42 # Verbose + reflist format php doi2jats.php -v -f reflist 10.30430/gjae.2023.0350 10.52825/bis.v1i.42
Installation
Using Composer (Recommended)
composer require citation-generator/doi2jats php vendor/citation-generator/doi2jats/doi2jats.php -h
Using github
git clone https://github.com/withanage/doi2jats/
cd doi2jats
composer install
Using github without Composer
The application includes a fallback PSR-4 autoloader, so it works without Composer.
Usage
Command-Line Options
| Option | Description |
|---|---|
-v, --verbose |
Show detailed processing information |
-f, --format FORMAT |
Output format: individual, reflist, back |
-h, --help |
Show help message |
Output Formats
Individual (Default)
Each citation as separate XML documents:
<!-- DOI: 10.30430/gjae.2023.0350 --> <?xml version="1.0" encoding="UTF-8"?> <element-citation publication-type="journal"> ... </element-citation> <!-- DOI: 10.52825/bis.v1i.42 --> <?xml version="1.0" encoding="UTF-8"?> <element-citation publication-type="journal"> ... </element-citation>
Reflist
All citations wrapped in a reference list:
<?xml version="1.0" encoding="UTF-8"?> <ref-list> <ref id="ref1"> <element-citation publication-type="journal"> ... </element-citation> </ref> <ref id="ref2"> <element-citation publication-type="journal"> ... </element-citation> </ref> </ref-list>
Back
Full back format with labels:
<?xml version="1.0" encoding="UTF-8"?> <back> <ref-list> <title>References</title> <ref id="bib1"> <label>1.</label> <element-citation publication-type="journal"> ... </element-citation> </ref> <ref id="bib2"> <label>2.</label> <element-citation publication-type="journal"> ... </element-citation> </ref> </ref-list> </back>
Error Handling
The application handles various error scenarios:
- Invalid DOI format: Shows specific error for malformed DOIs
- Network failures: handles API timeouts and connection issues
Example with Errors
$ php doi2jats.php -v 10.30430/gjae.2023.0350 invalid-doi 10.52825/bis.v1i.42 Processing 3 DOI(s) in 'individual' format... Processing DOI 1/3: 10.30430/gjae.2023.0350 Processing DOI 2/3: invalid-doi Error: Invalid DOI format: invalid-doi Processing DOI 3/3: 10.52825/bis.v1i.42 <!-- DOI: 10.30430/gjae.2023.0350 --> <?xml version="1.0" encoding="UTF-8"?> <element-citation publication-type="journal"> ... </element-citation> <!-- ERROR for DOI: invalid-doi - Invalid DOI format: invalid-doi --> <!-- DOI: 10.52825/bis.v1i.42 --> <?xml version="1.0" encoding="UTF-8"?> <element-citation publication-type="journal"> ... </element-citation> === SUMMARY === Total DOIs processed: 3 Successful: 2 Failed: 1 Failed DOIs: - invalid-doi: Invalid DOI format: invalid-doi
Development
- PHP Coding and code reading knowledge required. Tool does not contain method documentation.
Testing
composer test
Adding New Providers
- Create a new class implementing
CitationProviderInterface - Extend
AbstractCitationProviderfor common functionality - Add it to the providers array in
Application
Requirements
- PHP 8.1 or higher
- ext-dom
- ext-json
Contribution
- Lead and concept : Dulip Withanage (TIB) https://www.tib.eu
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-01