Both the XML SAX2 and JSON SAX2-like parsers are streaming (i.e., the XML or JSON to parse can be given in small chunks until the entire document is provided).
This example dem onstrates how this is done.