Fixed a bug in the XMLTool and added an Example code.

Both tool and example are not yet complete.