开发者

how to specify xml element having a xml attribute

What should be the class structure such that it serializes in the format given below

 <Header>
          <Version environment="debug">2.2</Version&开发者_JAVA技巧gt;
 </Header>

[XmlRoot]
public class Header
{
   [XmlElement]
   public string Version{get;set;}
}


[XmlRoot]
public class Header
{
    [XmlElement]
    public Version Version { get; set; }
}

public class Version
{
    [XmlAttribute("environment")]
    public String Environment { get; set; }

    [XmlText]
    public String Value { get; set; }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜