The language we have created stores the nutritional information on labels of foods in the United States. The document begins with acloud, followed by a element that gives the maximum amounts of fat, sodium, etc. to a diet of 2000 calories a day, and the units in which quantity is measured.
Daily Values ??are followed by a series ofelements, each of which provides information about a specific food and nutrition categories. Because element has already defined the units in each category is measured, which need not be repeated for all foods, just enter the numbers for total fat that particular food, sodium, etc. After the last meal is closed the document with a close tags.
<nutrition> <!-- Establish the daily values --> <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> <!-- Now list the individual foods --> <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> <!-- etc. --> </nutrition>
All numbers are real, only manufacturers' names have been changed to protect the innocent and avoid lawsuits. A quick note: Vitamins and minerals are measured in percentages do not, grams or milligrams. That is why it is necessary to establish a unit or maximum for them in the element. I entered the data in hand with the nedit program in Linux. Could use any editor that allows me to save files as plain text ASCII, Notepad in Windows or vi on Linux would have done equally well. To facilitate data entry, I created an empty "template" of a food, which appears at the bottom of the file. I copied and pasted to each new food, so I did not write labels and over again.