Understanding the parser API handle

You must create the parser API handle once for each of the XML or JSON documents or structures that will be processed. (Use the tpf_doc_initialize_handle function to initialize the parser API handle.) For example, in SOAP processing, the input parsed XML structure must have a parser API handle. Any new XML structure must also have a parser API handle.

When you are creating a new structure (that is, not parsing an existing document), the tpf_doc_initialize_handle function must be called first. However, because the new structure has not been created yet, the parameters are null. When you call the tpf_doc_createXMLstructure or tpf_doc_createJSONstructure function, the function creates a structure and associates it with the parser API handle that was passed.

The same is true for the tpf_doc_parseDocument function; that is, the tpf_doc_initialize_handle function must be called first. Because the structure for the parsed data has not been created yet, the pointer to the structure is null. When you call the tpf_doc_parseDocument function, the function updates the parser API handle with the address of the structure that contains the parsed data.

The following conditions apply to the structure that is associated with the parser API handle:
  • The structure is released when the tpf_doc_terminate_handle function is called if the z/TPF parser APIs (tpf_doc_createXMLstructure, tpf_doc_createJSONstructure, or tpf_doc_parseDocument function) were used to create the parser handle.
  • The structure cannot be used when the structure was passed on the tpf_doc_initialize_handle function after the tpf_doc_terminate_handle function is called.
  • The structure is released by the SOAP handler on return from the z/TPF application that is handling the SOAP request if the SOAP handler created the XML structure.