johan is correct. Mining with a high efficiency tool is probably the easiest way to gain XP (and resources!). Plus you can sell the resources.
I'm working on my own XP farm at the moment, trying out a method I'm developing. I have 32 zombie spawners that will drop zombies enough blocks so that they're down to half a heart. My plan is to build a little platform so that I can throw splash potions on them without endangering myself. Note to potion newbies, some potions have the opposite effect on zombies (i.e. use instant health potions to inflict instant damage).
Protip: Wait to put the Spawners in until
after you have the trap/containment area built. Otherwise you have a bunch of zombies on the loose...