Better than a cage is a wire enclosure hooked to a "doggie door" leading outdoors.
A dog will not soil his sleeping quarters and will go outdoors when the urge occurs. Once indoors, though, you've got to keep an eagle-eye on his behavior—especially upon awakening—and even more vigilant when waking up after a meal. (The dog's meal, that is.
)
If you have a wood floor with area rugs, I'd remove the rugs. An undiscovered "pee-accident" can permanently darken the wood underneath.