gpt4 book ai didi

xml - Windows 批处理 : Read a very long line from unformatted xml

转载 作者:可可西里 更新时间:2023-11-01 10:05:52 25 4
gpt4 key购买 nike

如何使用批处理文件读取很长一行未格式化的 xml?我试图在每个“>”之后插入一个换行符。

问题是,我的批处理文件在找到“>”后跳到下一行。

并且由于这种行为,只显示了我的 xml 文件的第一个标记(只有一行,第二行不存在)。

这是我用过的命令:

FOR /F "delims=>" %%i IN (test.xml) DO @echo %%i

这是我的 xml 文件的外观示例:

<simpleType name="parseType"><restriction base="xs:token"><enumeration value="xml"/<enumeration value="text"/></restriction></simpleType>

这是 cmd 命令的输出:

<simpleType name="parseType"

最佳答案

这是一种强大的处理方式,可以处理很长的行:

type "file.txt" | repl ">" ">\r\n" XL >"newfile.txt"

这使用一个名为 repl.bat 的辅助批处理文件(由 dbenham 提供)- 下载自:https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

repl.bat 放在与批处理文件相同的文件夹中或路径上的文件夹中。

关于xml - Windows 批处理 : Read a very long line from unformatted xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25889052/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com