Verifying XML and JSON Parsing

Use the Document Tester utility to verify the proper XML or JSON parsing of data and subsequent generation of XML or JSON.

This capability is useful for inbound data that will subsequently be loaded into a document, as you can validate that the data is of a valid format and structure expected based on the format type.

Generating and Parsing XML Structures

The PeopleCode to generate an XML structure is as follows:

&string = &DOC.GenXMLString(); 
// returns an XML string based on the Document.

The PeopleCode to parse an XML structure is as follows:

&bool = &DOC.ParseXMLString(string &xmldata, <optional> bool &b);
// The second parameter is optional and will validate the XML data based on 
// the XML schema if set to TRUE.

Generating and Parsing JSON Structures

The PeopleCode to generate a JSON structure is as follows:

&string = &DOC.GenJsonString();  
// returns a JSON string based on the Document.

The PeopleCode to parse a JSON structure is as follows:

&bool = &DOC.ParseJsonString(string &jsondata, <optional>  bool &b);  
// The second parameter is optional and will validate the JSON data based on 
// the XML schema if set to TRUE.