0
我想使用xmlstarlet修改xml文件的值(我知道如何使用grep或sed修改該行,但我想學習xmlstarlet)。使用xmlstarlet更新屬性的值
我正在查看官方文檔(http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html),但我是一個完整的xml結構。
我想在這裏修改的值:
<ExtraDataItem name="GUI/UpdateDate" value=""/>
這是我試過的命令,但輸出相同的輸入值:
xml edit --update "//ExtraDataItem[@name='GUI/UpdateDate']/@value" --value "never" virtualbox.xml
這是XML文件:
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.12-windows">
<Global>
<ExtraData>
<ExtraDataItem name="GUI/DetailsPageBoxes" value="general,system,preview,display,storage,audio,network,usb,sharedFolders,description"/>
<ExtraDataItem name="GUI/GroupDefinitions/" value="m=3fa2f128-b094-40c1-bec6-6580b0ac597a,m=65c3158a-330e-4456-b770-768dfecc788f"/>
<ExtraDataItem name="GUI/HostScreenSaverDisabled" value="false"/>
<ExtraDataItem name="GUI/Input/AutoCapture" value="true"/>
<ExtraDataItem name="GUI/Input/HostKeyCombination" value="163"/>
<ExtraDataItem name="GUI/LastItemSelected" value="m=Windows XP SP3 (x86)"/>
<ExtraDataItem name="GUI/LastWindowPosition" value="575,245,770,550"/>
<ExtraDataItem name="GUI/SplitterSizes" value="289,477"/>
<ExtraDataItem name="GUI/SuppressMessages" value=",remindAboutInaccessibleMedia,cannotAccessUSB"/>
<ExtraDataItem name="GUI/TrayIcon/Enabled" value="false"/>
<ExtraDataItem name="GUI/UpdateCheckCount" value="3"/>
<ExtraDataItem name="GUI/UpdateDate" value=""/>
</ExtraData>
<MachineRegistry>
<MachineEntry uuid="{65c3158a-330e-4456-b770-768dfecc788f}" src="C:\Users\Administrador\VirtualBox VMs\Windows 7 x64\Windows 7 x64.vbox"/>
<MachineEntry uuid="{3fa2f128-b094-40c1-bec6-6580b0ac597a}" src="C:\Users\Administrador\VirtualBox VMs\Windows XP SP3 (x86)\Windows XP SP3 (x86).vbox"/>
</MachineRegistry>
<MediaRegistry>
<HardDisks/>
<DVDImages/>
<FloppyImages/>
</MediaRegistry>
<NetserviceRegistry>
<DHCPServers>
<DHCPServer networkName="HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter" IPAddress="192.168.56.100" networkMask="255.255.255.0" lowerIP="192.168.56.101" upperIP="192.168.56.254" enabled="1"/>
</DHCPServers>
</NetserviceRegistry>
<SystemProperties defaultMachineFolder="C:\Users\Administrador\VirtualBox VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3"/>
<USBDeviceFilters/>
</Global>
</VirtualBox>
是否有[Namespaces](http://xmlstar.sourceforge.net/doc/UG/ch05s01.html)章節的幫助? – npostavs
是的!我已經解決了你的幫助,謝謝 – ElektroStudios