0

我需要在下面的结构中创建一个 xml。

<ipaddress> "10.10.10.10" </ipaddress> 
<PipeId pid = "4598702C-691E">testvalue</PipeId> --how to display this?
<name> "testname" </name> 

但我真的对 xml 中的第二行感到困惑。怎么能显示出来?

我尝试了下面的代码..但不知道如何将第二行放入 xml..

new XElement("StartElement",
new XAttribute("TestAtt", "some & value"),
new XElement("ipaddress", "10.10.10.10"),
new XElement("name", "testname")));
4

1 回答 1

2

如果您只是想构建该元素,则需要:

new XElement("PipeId",                       // Name of the element
    new XAttribute("pid", "4598702C-691E"),  // Attribute of the element
    "testvalue")                             // Text content of the element
于 2013-03-21T15:33:48.880 回答