I am trying to create serializable class but I want to map second level element to my property of class. What's the best way of doing this.
Example xml & class
<SearchResult>
<Head>
<Title q="test">My search Result</Title>
</Head>
<Results>
<Result>...</Result>
<Result>...</Result>
<Result>...</Result>
</Results>
</SearchResult>
[Serializable]
[XmlRoot(ElementName = "GSP")]
public class SearchResult
{
**[XmlElement(ElementName=@"Head\Title")]**
public string Title { get; set; }
[XmlArray(ElementName = "Results")]
[XmlArrayItem(ElementName = "Result")]
public List<ResultItem> mySearchResultItems { get; set; }
}
[Serializable]
public class ResultItem
{
...
}
So, In my example I would like to map Title property to <Head><Title>
text value in xml
Thanks for your help!!