可以用xmlstarlet,对每个npc容器,输出id属性,输出ai子容器的aggro属性:- xmlstarlet sel -t -m '//npc' -v './@id' -o , -v './ai/@aggro' -o $'\n' a.xml
复制代码 也可以用pwsh解析:- #&cls&powershell "type '%~0'|out-string|iex"&pause&exit
- $x = New-Object System.Xml.XmlDocument
- $x.Load(".\a.xml")
- $x.list.npc | ForEach-Object {
- $id = $_.id
- $_.ai | ForEach-Object {
- [PSCustomObject]@{npcId=$id;aggro=$_.aggro}
- }
- } | Export-Csv -NoTypeInformation a.csv
复制代码
|