3
XMLのいずれかの要素にコンテンツが混在する可能性はありますか?string
ではなく、混合要素のテキストをカスタムオブジェクトとして逆シリアル化しますか?C#XML混在コンテンツのテキストをカスタムオブジェクトとしてデシリアライズしますか?
私はこれを試してみました:テキスト項目を期待
[XmlText(typeof(textType))]
[XmlElement("query", typeof(templateBodyQuery))]
[XmlElement("expand", typeof(expandType))]
[XmlElement("insert", typeof(expandTypeInsert))]
public object[] Items { get; set; }
はtextType
としてシリアライズされるだろうが、私は'textType' cannot be used as 'xml text'
エラーを取得します。あなたがのXmlTextのために非プリミティブ型を使用することはできません
public class textType
{
[XmlText]
public string Value { get; set; }
}