0
我想创建一个XML结构像下面的XML:如何创建这种结构
<root>
<element name= "text here 1">
<child>asd</child>
<child>asd</child>
</element>
<element name= "text here 2">
<child>asd</child>
<child>asd</child>
</element>
</root>
我熟悉
XElement doc = XElement.Load(mainDirectory);
XElement newElem = new XElement("element", new XElement(child, ""), new XElement(child, ""));
doc.Add(newElem);
doc.Save(mainDirectory);
所以我觉得这落下如何添加的“属性”当我创造“元素”
你的XML无效 – Anirudha
添加'XAttribute' –
无效的XML你不能让元素=“文字2”.. – Obama