Nutrtionmaps v0.2 XML format - Restaurant Protocol
Jump to:
XML tag definitions
Entity escaping
This document describes the XML schema for the Nutrtionmap protocol.
The Nutritionmap protocol format consists of XML tags. All data values in a Nutritionmap must be entity-escaped. The file itself must be UTF-8 encoded.
The Nutritionmap must:
- Begin with an opening
<nutritionmap>
tag and end with a closing</nutritionmap>
tag. - Specify the brand of the food item (protocol standard) within the
<foodbrand>
tag. - Include at least one
<item>
entry for the packaged tag. - Include at least one child entry for each
<nutrition>
parent tag.
All other tags are optional. However, we encourage you to provide as much nutritional information as possible to make your map as useful as it can be.
All URLs inside of a Nutritionmap must be from one domain. I.E. www.examplesite.com or food.examplesite.com but not both.
Sample XML Nutritionmaps
Click here to see a sample Nutritionmap for a brand with one packaged food item that includes pricing, nutrition information and ingredients.
XML tag definitions
The available XML tags are described below.
Attribute | Description | |
---|---|---|
<nutritionmap>
|
required |
Encapsulates the file and references the current protocol standard. |
<foodbrand>
|
required |
Parent tag for the brand's information |
<packaged>
|
required |
Parent tag for the brand's food items. |
<packageditem>
|
required |
The parent tag for each packaged food item. |
<packagediteminfo>
|
required |
The parent tag for the general information about a packaged food item. |
<nutrition>
|
required |
The parent tag for the nutrition information |
<ingredients>
|
optional |
The parent tag for ingredients in a food item. |
<name>
|
optional |
A child tag that when used under the parent When used under the parent |
<nation>
|
optional |
The nation where the brand is headquartered when used under the |
<region>
|
optional |
The region where the food items in the map are being sold or distributed. This allows a map to divide up food items that share the same name but slightly different ingredients in different parts of the nation or world. |
<loc>
|
required* |
A child tag that when used under the foodbrand parent tag is the brand's main website URL. When used under the packageditem tag is the URL to the specific packaged food item. * = only required for the brand parent tag |
<price>
|
optional |
The price of a food item. |
<itemid>
|
required |
The unique i.d. number of a food item. numeric i.d. only. this must be unique to the food item and never change as databases will use it for reference in applications. |
<currency>
|
optional |
The currency code for the food item's price You can get a list of currency codes here: currency code list |
<itemtype>
|
optional |
The type of food item. This is an closed field. Choose from these types:
|
<packaging>
|
optional |
A child tag to the required packaged item tag. This says what type of packaging is used. You can use one or more types of packaging. Choose from these selections:
|
<servingsize>
|
optional |
A child tag to the required packageditem tag. This says what the size per serving of the item is. |
<servingsizemeas>
|
optional |
A child tag to the required packageditem tag. This is what the serving size is measured in. Foods are typically measured in length, mass, or fluid capacity. this can be imperial, metric, or SI measurements. Use abbreviations only (listed below).
|
<servings>
|
optional |
A child tag to the required packageditem tag. This says how many servings are in the packaged food item. |
<netweight>
|
optional |
A child tag to the required pacakgeditem tag. This says what the net weight of the food time is. |
<netweightmeas>
|
optional |
A child tag to the required packageditem tag. Tells the total weight of the packaged food item, typically measured in mass. this can be imperial, metric, or SI measurements. Use abbreviations only (listed below).
|
<ethnicity>
|
optional |
A child tag to the required packageditem tag. If the food item is ethnic, this tag describes it. Use more than one ethnicity tag to describe a 'fusion' food. |
<frozen>
|
optional |
A child tag to the required packageditem tag. If frozen just put 'yes' between this tag. Any other entry should mean that the product is not frozen. |
<expiration>
|
optional |
A child tag to the required packaged item tag. This tells the date when the item will expire. Use Year-Month-Date format (i.e. 2013-6-12 for June 12th, 2013). |
<creation>
|
optional |
A child tag to the required packageditem tag. This tells the date when the item was created. Use Year-Month-Date format (i.e. 2012-6-12 for June 12th, 2012). |
<meat>
|
optional |
A child tag to the required ingredients tag. This tells what kind of meat is included. Use more than one tag for multiple meats in a product. |
<ingredient>
|
optional |
A child tag to the meat,vegetable,bread,fruit,dairy,perservative tags. This tells what kind of the parent product is included. Use more than one tag for multiple ingredients in a product. |
<mechseparated>
|
optional |
A child tag to the meat parent tag. This tells if the meat was mechanically separted. Just place a Yes if it was, anything else will mean no. |
<calories>
|
optional |
A child tag to the required nutrition tag. This says how many calories are in a food item. |
<fat>
|
optional |
A child tag to the required nutrition tag. This says how much fat is in a food item. Measured in grams (g) |
<satfat>
|
optional |
A child tag to the required nutrition tag. This says how much saturated fat is in a food item. Measured in grams (g) |
<transfat>
|
optional |
A child tag to the required nutrition tag. This says how much trans fat is in a food item. Measured in grams (g) |
<calfat>
|
optional |
A child tag to the required nutrition tag. This says how many calories come from fat in a food item. |
<cholesterol>
|
optional |
A child tag to the required nutrition tag. This says how much cholesterol is in a food item. Measured in milligrams (mg) |
<sodium>
|
optional |
A child tag to the required nutrition tag. This says how much sodium is in a food item. Measured in milligrams (mg) |
<carbs>
|
optional |
A child tag to the required nutrition tag. This says how many carbohydrates are in a food item. Measured in grams (g) |
<fiber>
|
optional |
A child tag to the required nutrition tag. This says how much fiber is in a food item. Measured in grams (g) |
<sugar>
|
optional |
A child tag to the required nutrition tag. This says how much sugar is in a food item. Measured in grams (g) |
<protein>
|
optional |
A child tag to the required nutrition tag. This says how much protein is in a food item. Measured in grams (g) |
<vegan>
|
optional |
a Yes/No field. states if a food item is vegan friendly |
<vegetarian>
|
optional |
a Yes/No field. states if a packaged food item is vegetarian friendly |
<vitamins>
|
optional |
a parent tag that encapsulates vitamin information for a food item. |
<vitamina>
|
optional |
a child tag to the optional vitamins parent tag that says the percentage of daily intake of vitamin A per serving of the food item based on a 2,000 calorie diet. |
<vitaminc>
|
optional |
a child tag to the optional vitamins parent tag that says the percentage of daily intake of vitamin c per serving of the food item based on a 2,000 calorie diet. |
<iron>
|
optional |
a child tag to the optional vitamins parent tag that says the percentage of daily intake of iron per serving of the food item based on a 2,000 calorie diet. |
<calcium>
|
optional |
a child tag to the optional vitamins parent tag that says the percentage of daily intake of calcium per serving of the food item based on a 2,000 calorie diet. |
<oven>
|
optional |
a parent tag that encapsulates oven cooking information. |
<microwave>
|
optional |
a parent tag that encapsulates microwave cooking information. |
<cooktime>
|
optional |
a child tag that can be used with oven or microwave parent tags. Describes the amount of time in seconds (sec) that the food item needs to cook. Adding a number to the end of the tag such as <cooktime1> and <cooktime2> denotes multiple cooking instructions with a pause for human inspection in between. |
<preheat>
|
optional |
a child tag that can be used with oven parent tag to denote the preheat temperature of the oven (farenheight). |
<cooltime>
|
optional |
a child tag that can be used with oven or microwave parent tag. Describes the amount of time in seconds (sec) that the food item needs to cool. |
<defrost>
|
optional |
a child tag that can be used with the microwave parent tag. Describes the amount of time in seconds (sec) that the food item needs to defrost. Like with the cooktime tag adding a number to the end denotes multiple defrosting times in a row with a pause for human intervention in between. |
<powerlevel>
|
optional |
a child tag that can be used with the microwave tag. Describes the power level for the settings. Can choose from High, Medium or Low. Based on 1,000 watt microwave. |
Entity escaping
It is required that your Nutritionmap file be UTF-8 encoded.
Just like any other XML file, all of your data values must use entity escape codes for the following characters: Ampersand, Quotes, Double Quotes, Greater Than, Less Than. This includes URLs
Last Updated: 12 May 2012
Nutritionmaps.org is the sole copyright and ownership of creator Joe Youngblood. To reach out about licensing the language for usage in your commercial food manufacturing, fresh food preparation, restaurant food preparation, or other food or nutrition application please CLICK HERE TO GET IN TOUCH