I have the following XML file:
<Error>0</Error>
<Description>1</Description>
<Document>
<ObjectID>06098INF1761320</ObjectID>
<ced>109340336</ced>
<abstract>DAVID STEVENSON</abstract>
<ced_a />
<NAM_REC />
<ced_ap2 />
</Document>
So I deserialize it on C# (4.0) with this objects structure:
[XmlElement("Error")]
public string Error { get; set; }
[XmlElement("Description")]
public string Description { get; set; }
[XmlElement("Document")]
public List<EDocument> LstDocument { get; set; }
So here's my issue: the element "Document" has unknown sub-elements: ObjectID, ced, etc., is there a way that I can deserialize those unknows elements into a List, Array, Dictionary or something to iterate with (something like this, it DOESN'T have to be exactly like this, I'm just guessing):
object.LstDocument[0].ListDocument.name; //to get the name
object.LstDocument[0].ListDocument.value; //to get the value
Any help would be appreciated.
EDIT 1:
To add some extra clarification to my question: The child nodes under "Document" element are unknown because they are variable, with this I mean that at a moment I could have "ObjectID" and "ced", i开发者_JAVA百科n other moment they could be "ced","ABC", etc. I'm not sure which elements came there as child nodes, all I know is that they are elements (not attributes) and that they don't have any child-nodes inside them.
精彩评论