Complete XML writer implementation.

Fix ObjectInputStream logic.