(view source code of xpath_php.bat as plain text)
@ECHO OFF
IF NOT "%~3"=="" GOTO Syntax
IF "%~2"=="" GOTO Syntax
IF /I NOT "%~x1"==".xml" GOTO Syntax
IF NOT EXIST "%~1" GOTO Syntax
PHP.EXE -r "$xml=simplexml_load_file('%~1'); foreach($xml->xpath(\""%~2\"") as $result){print(\""{$result}\n\"");}"
GOTO:EOF
:Syntax
ECHO.
ECHO %~nx0, Version 1.00
ECHO Use PHP to display the results of an XPath expression against an XML file
ECHO.
ECHO Usage: %~nx0 xml_file xpath_expression
ECHO.
ECHO Example: %~nx0 example.xml "//*/@*" (list all attribute values for all nodes)
ECHO.
ECHO Written by Rob van der Woude
ECHO https://www.robvanderwoude.com
EXIT /B 1
page last modified: 2024-04-16; loaded in 0.0078 seconds