5.3. Using Pantry XML files to edit units or nutrients of foods
Prev | Chapter 5. Adding new foods and editing the nutrients or units of existing foods | Next

## 5.3. Using Pantry XML files to edit units or nutrients of foods

As you already know, you can easily edit the traits of foods in Pantry. But what if you want to edit the nutrients or available units of a food? As you can probably guess now, the solution is to use a Pantry XML file. Pantry XML files behave just like Pantry native files. So if, for example, you wish to edit foods in the `master` file, you can simply create a Pantry XML file with the foods you wish to edit. Pantry automatically creates a Pantry XML file if you use the extension `.xml`. So, to create a Pantry XML file with bananas, use `pantry --add banana.xml --name 'Bananas, raw' master`. You can then edit this food however you wish, and you can then add the results back to the `master` file using the `--add` option.

Remember that Pantry will not allow you to have two identical foods in a single file. Two foods are considered identical if their traits are identical, even if their nutrients or their available units differ. If foods are identical, Pantry will simply add `(Copy x)` to the food's `Comment` trait. Keep this in mind if, for example, you edit the banana in the `banana.xml` file and then add it back to the `master` file.

Prev | Up | Next
5.2. Using a Pantry XML file | Home | 5.4. Validation of Pantry XML files