For the weapon, hitting things.
For the armour, getting hit.
Er, that sounds overly simple, but it really isn't a complex issue. When you successfully hit things, there's a chance the weapon gets damaged. When you get hit, it picks an armour slot and there's a chance that the item in that slot gets damaged.
EDIT: Of course, there'd also be the exceptions for which skills lower durability and which don't. For example, blade fury doesn't affect weapon durability while blade shield does.
For the armour, getting hit.
Er, that sounds overly simple, but it really isn't a complex issue. When you successfully hit things, there's a chance the weapon gets damaged. When you get hit, it picks an armour slot and there's a chance that the item in that slot gets damaged.
EDIT: Of course, there'd also be the exceptions for which skills lower durability and which don't. For example, blade fury doesn't affect weapon durability while blade shield does.