Mending is an enchantment which restores durability of an item using Experience Orbs.
Usage
When an item with the enchantment is held or equipped (in the main hand, offhand, or armor slots), collected experience orbs repair the item at a rate of 2 durability per XP instead of adding the XP to the player's total experience. If multiple items have the enchantment, one is chosen at random for each XP orb collected, and if the chosen item does not need repair, the XP is added to the player's total as normal, rather than choosing another item to repair.
For example, fishing with a fishing rod costs 1 point of durability but earns 1–6 experience points when reeling in a catch. A damaged fishing rod used this way eventually restores itself to full durability and any excess experience points apply to the player's experience.
Obtaining
Mending counts as a treasure enchantment; it can be obtained from chest loot, fishing, raids or trading. It cannot be obtained from an enchanting table.
Incompatibilities
Mending and Infinity are mutually exclusive, meaning that only one enchantment can be granted on a given item in a survival based world. However, if combined using commands, both enchantments function as normal.