有没有人知道XmlSerializer是否支持内联元素?
例如,我正在尝试解析类似这样的内容
<foo>This sample has an inline <barZ x="1" /> element <barX>.</barX></foo>
提前致谢!
更新
好的,我发现了......
似乎它需要这样的东西
[XmlElement("barZ", typeof(BarZ))]
[XmlElement("barX", typeof(BarX))]
public object[] Items { get; set; }
[XmlText]
public string[] Text { get; set; }
现在的问题是Items
属性保留元素和Text
字符串。
当尝试再次序列化时,值的初始顺序不起作用......