[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 【已解决】求助批处理从一堆XML中提取关键词写到csv中

本帖最后由 zhengwei007 于 2024-3-27 23:38 编辑

我有若干个XML文件,内容如下:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/multisell.xsd">
  3. <npcs>
  4. <npc>32615</npc> <!-- Ishuma (Maestro) -->
  5. </npcs>
  6. <item>
  7. <!-- Vesper Cutter -->
  8. <ingredient count="1" id="13457" />
  9. <!-- Sirra's Blade -->
  10. <ingredient count="1" id="8678" />
  11. <!-- Dualsword Craft Stamp -->
  12. <ingredient count="1" id="5126" />
  13. <!-- Adena -->
  14. <ingredient count="7168000" id="57" />
  15. <!-- Vesper Dual Sword -->
  16. <production count="1" id="52" />
  17. </item>
  18. <item>
  19. <!-- Stormbringer -->
  20. <ingredient count="1" id="72" />
  21. <!-- Caliburs -->
  22. <ingredient count="1" id="75" />
  23. <!-- Dualsword Craft Stamp -->
  24. <ingredient count="1" id="5126" />
  25. <!-- Crystal (C-Grade) -->
  26. <ingredient count="183" id="1459" />
  27. <!-- Adena -->
  28. <ingredient count="548100" id="57" />
  29. <!-- Stormbringer*Caliburs -->
  30. <production count="1" id="2566" />
  31. </item>
复制代码
希望通过批处理对以上所有文件内容输出到一个CSV文件,标题我写,格式如下:
  1. ingredientID count ingredientID count ingredientID count ingredientID count ingredientID count productionID count
  2. 13457 1 8678 1 5126 1 57 7168000 52 1
  3. 72 1 75 1 5126 1 1459 183 57 548100 2566 1
复制代码
以上就是最终格式,谢谢!
1

评分人数

    • Batcher: 感谢给帖子标题标注[已解决]字样PB + 2

只处理同级目录下的xml文件
ppll2030 发表于 2024-3-27 22:27


太厉害了,感谢感谢!

TOP

返回列表