Because you assumed that a Node's toString() method would return an XML representation of that Node and its children and attributes. If you look, you will see that the documentation doesn't say it works that way. So implementations don't have to do that. Do an identity transformation and send the output to a StringWriter if you want to serialize the Node ...