Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for xpath_php.bat

(view source code of xpath_php.bat as plain text)

  1. @ECHO OFF
  2. IF    NOT  "%~3"==""     GOTO Syntax
  3. IF         "%~2"==""     GOTO Syntax
  4. IF /I NOT "%~x1"==".xml" GOTO Syntax
  5. IF NOT EXIST "%~1"       GOTO Syntax
  6. PHP.EXE -r "$xml=simplexml_load_file('%~1'); foreach($xml->xpath(\""%~2\"") as $result){print(\""{$result}\n\"");}"
  7. GOTO:EOF
  8.  
  9.  
  10. :Syntax
  11. ECHO.
  12. ECHO %~nx0,  Version 1.00
  13. ECHO Use PHP to display the results of an XPath expression against an XML file
  14. ECHO.
  15. ECHO Usage:    %~nx0  xml_file  xpath_expression
  16. ECHO.
  17. ECHO Example:  %~nx0  example.xml "//*/@*" (list all attribute values for all nodes)
  18. ECHO.
  19. ECHO Written by Rob van der Woude
  20. ECHO https://www.robvanderwoude.com
  21. EXIT /B 1
  22.  

page last modified: 2024-04-16; loaded in 0.0078 seconds