apolinux/xmltoxpath

此包的最新版本(v1.04)没有可用的许可证信息。

将XML文件转换为xpath数组列表的工具

v1.04 2020-03-19 21:12 UTC

This package is auto-updated.

Last update: 2024-09-20 07:20:06 UTC


README

将简单的XML文档转换为xpath列表

返回包含xpath路径的行列表。仅适用于标签,不适用于属性。

安装

composer require apolinux/xmltoxpath

示例

./vendor/bin/xmltoxpath path/to/xmlfile.xml 

返回类似以下内容

/movie/title
/movie/characters/character/name
/movie/characters/character/actor
/movie/characters/character/name
/movie/characters/character/actor
/movie/plot
/movie/great-lines/line
/movie/rating
/movie/rating

显示帮助信息

./vendor/bin/xmltoxpath
Usage: xmltoxpath xmlfile [ u ]
Where: 
 - xmlfile: is the xml filename to process
 - u      : if appears then only show unique results

单元测试

phpunit --bootstrap ./test/bootstrap.php test/XmlToXpathTest.php 
PHPUnit 6.2.3 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 89 ms, Memory: 10.00MB

OK (1 test, 2 assertions)