Ok, so I need to be able to edit a profile in a GUI (all fields except Profile Name) or select a Profile (by Name) to be removed from the xml document I'm using.
Currently I have a listView that holds all Items in the XML doc as 'profile' objects (consisting of 3 strings and dividing Collections element into 3 bool values) I have an idea on how to delete items, I could simply remove one from the listview and then write the remaining items to the xml, BUT how do I do that so it isn't adding to the file, but rather overwriting its content?
Also Is there a way to edit an element via searching for its Profile by name and tweaking its child nodes? let me know if there's a more efficient deletion method and the best way to edit node's children!
to summarize:
Example XML file to be worked with:
<?xml version="1.0" encoding="utf-8"?>
<Profiles>
<Profile Name="Tool3927">
<ToolName>01.11.1221</ToolName>
<SaveLocation>C:\Users\13\Desktop</SaveLocation>
<Collections>False.True.False</Collections>
</Profile>
<Profile Name="MyTool">
<ToolName>US.01.8280</ToolName>
<SaveLocation>C:\Users\13\Desktop</SaveLocation>
<Collections>True.True.True</Collections>
</Profile>
<Profile Name="TestProfile">
<ToolName>11.11.1111</ToolName>
<SaveLocation>C:\</SaveLocation>
<Collections>True.False.False</Collections>
</Profile>
<Profile Name="a">
<ToolName>za-za-zaza</ToolName>
<SaveLocation>C:\Users\13\Desktop\tester</SaveLocation>
<Collections>False.True.False</Collections>
</Profile>
</Profiles>
我将使用XPath到达要删除的节点,然后查看此答案以进行删除。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.