Adding support for XML and JSON streams with callback functions