Add support for importing data from an xml file
Because xml is not structured as nicely as json or csv for working with, will need to add some form of querying abilities into the xml objects, would suggest using something like the following.
~ explicitly identifies we're looking for a child element, which can optionally have some query criteria added to it such as First, Last, All, or which numbered occurrence we're looking for
The ~ can also be used to get the node tag name of an element, for example: ~TagName
@ explicitly identifies we're looking for an attribute on the element (@ = at = attribute)
The lack of ~ or @ means the returned value can either be from a child element or an attribute.
Model.~First_food.~First_calories.@total.Value //110
Model.~First_food.~First_calories.@total.Name //total
Model.~food.~calories.@total.Value //110
Model.food.calories.fat.Value //100
Model.~All_food //List of all child elements of Model of type food
Model.~Last_food //The Bagels, New York Style food element
Model.~First_food.vitamins.~All //The <a>0</a><c>0</c> elements
Model.~0_food.vitamins.~All //The <a>0</a><c>0</c> elements
Model.~1_food.vitamins.~All
Model.~2_food.vitamins.~All //null
Model.~food.~vitamins.~First.~TagName //a
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="nutrition.css"?>
<nutrition>
<daily-values>
<total-fat units="g">65</total-fat>
<saturated-fat units="g">20</saturated-fat>
<cholesterol units="mg">300</cholesterol>
<sodium units="mg">2400</sodium>
<carb units="g">300</carb>
<fiber units="g">25</fiber>
<protein units="g">50</protein>
</daily-values>
<food>
<name>Avocado Dip</name>
<mfr>Sunnydale</mfr>
<serving units="g">29</serving>
<calories total="110" fat="100"/>
<total-fat>11</total-fat>
<saturated-fat>3</saturated-fat>
<cholesterol>5</cholesterol>
<sodium>210</sodium>
<carb>2</carb>
<fiber>0</fiber>
<protein>1</protein>
<vitamins>
<a>0</a>
<c>0</c>
</vitamins>
<minerals>
<ca>0</ca>
<fe>0</fe>
</minerals>
</food>
<food>
<name>Bagels, New York Style </name>
<mfr>Thompson</mfr>
<serving units="g">104</serving>
<calories total="300" fat="35"/>
<total-fat>4</total-fat>
<saturated-fat>1</saturated-fat>
<cholesterol>0</cholesterol>
<sodium>510</sodium>
<carb>54</carb>
<fiber>3</fiber>
<protein>11</protein>
<vitamins>
<a>0</a>
<c>0</c>
</vitamins>
<minerals>
<ca>8</ca>
<fe>20</fe>
</minerals>
</food>
</nutrition>
Edited by James Coyle