【发布时间】:2020-09-26 21:03:11
【问题描述】:
这是我的 xml 字符串。
<test name="james" type="seoul" xmlns="test:client">
<friends xmlns="friends:test">
<friend xmlns="" name="john">
Google
</friend>
<friend xmlns="" name="john">
Amazon
</friend>
</friends>
</test>
我在后面尝试了这段代码。
[Serializable()]
[XmlRoot(ElementName = "test", Namespace = "test:client")]
public class TestModel
{
public TestModel()
{
}
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("type")]
public string Id { get; set; }
}
我永远无法更改 xml。我想在朋友元素中列出内容。 请帮帮我!!
【问题讨论】:
标签: c# xml serialization