I have an XML file that contains elements that have lists of items:
<recipe>
<title>Recipe 1</title>
<ingredients><li>eggs</li><li>milk</li><li>etc...</li></ingredients>
<instructions><li>break eggs</li><li>spill milk</li><li>enjoy!</li></ingredients>
</recipe>
I am using Visual Studio C# XmlReader.Deserialize() to deserialize the XML into a class that I would like to look like this:
public class recipe
{
string title;
string ingredients[];
string instructions[];
}
Where each element of ingredients and instructions would be the text between li tags.
Worse comes to worse, I would accept ingredients and instructions each being a single string that I could then parse out the li tags.
Any suggestions on how to accomplish this?
No comments:
Post a Comment