我是WPF的新手,正在尝试将子节点写入XML文件。这是文件...<?xml version="1.0" encoding="utf-8"?><Sequences> <LastSavedSequence name="Last Saved Sequence"> <Test name="Measure Battery Current(Stim)" testNumber="5" Vbat="3.7" Frequency="20" PulseWidth="500" Amplitude="1" Resistance="1600" Anode="1" Cathode="2" ActiveDischarge=""/> <Test name="Measure Batther Current(No Stim)" testNumber="6" Vbat="2.9" Frequency="20" PulseWidth="500" Amplitude="1" Resistance="1600" Anode="1" Cathode="2" ActiveDischarge=""/> </LastSavedSequence> <ScottTestSequence name="Scott Test Sequence"> <Test name="VMO Status" testNumber="4" Vbat="3.7" Frequency="20" PulseWidth="1000" Amplitude="6" Resistance="3000" Anode="1" Cathode="2" ActiveDischarge=""/> <Test name="Measure Battery Current(Stim)" testNumber="5" Vbat="3.7" Frequency="20" PulseWidth="500" Amplitude="1" Resistance="1600" Anode="1" Cathode="2" ActiveDischarge=""/> <Test name="Measure Batther Current(No Stim)" testNumber="6" Vbat="2.9" Frequency="20" PulseWidth="500" Amplitude="1" Resistance="1600" Anode="1" Cathode="2" ActiveDischarge=""/> </ScottTestSequence> </Sequences>我正在尝试创建要放入其中的XML子块。我使用了stringBuilder,然后尝试做一个附加子项,然后是一个.save。XMLData2是一个全局列表,包含每个子元素的子元素。这是我的代码...public static List<System.Xml.XmlNode> xmlData2 = new List<System.Xml.XmlNode>();XmlDocument xmlFromOutSideSequenceFile = new XmlDocument(); xmlFromOutSideSequenceFile.Load("c:\\Users/StarkS02/Documents/SavedSequenceFile.xml");StringBuilder exampleNode = new StringBuilder(); exampleNode.Append("<");我在.appendChild语句上收到编译器错误,无法将stringBuilder转换为XML节点。这很有道理,但我不确定如何解决。有任何想法吗?
1 回答
- 1 回答
- 0 关注
- 213 浏览
添加回答
举报
0/150
提交
取消