Overview

With the aid of the PLC library Tc3_JsonXml, SAX and DOM parser technologies can be used to create and navigate through JSON and XML documents. See the chapter Terms and general information for further details.

Function blocks

The following table is intended to provide an initial overview of the various options available for working with JSON and XML documents in Tc3_JsonXml.

Function block

Typical applications

Recommendation

FB_JsonDomParser

JSON documents with only a few changes.

The FB_JsonDomParser is used when a JSON document needs to be loaded and modified in just a few places.

FB_JsonDynDomParser

JSON documents with many changes.

The FB_JsonDynDomParser is used when numerous changes are made to a JSON document without releasing the document between modifications.

FB_JsonSaxReader

Read JSON documents sequentially and process them as they are parsed.

The FB_JsonSaxReader is used when a JSON document needs to be processed sequentially and its contents need to be evaluated via Callback methods during parsing.

FB_JsonSaxWriter

Generate JSON documents step by step.

The FB_JsonSaxWriter is used when a JSON document needs to be set-up sequentially.

FB_JsonSaxPrettyWriter

Generate JSON documents step by step and with proper formatting.

The FB_JsonSaxPrettyWriter is used when a JSON document needs to be generated in the same way as with the SAX writer, but formatted with additional whitespace to improve readability.

FB_JsonReadWriteDataType

Convert PLC data structures or symbols to JSON and write them back.

The FB_JsonReadWriteDataType is used when generating the JSON representation of a symbol or structure, or when transferring the contents of a JSON object into an equivalent data structure.

FB_XmlDomParser

Load and edit XML documents.

Use FB_XmlDomParser to load, navigate, read, and modify XML documents.