Json相关功能块

3.1 FB_JsonDomParser

This function block is derived from the same internal function block as FB_JsonDynDomParser [} 44] and thus offers the same interface.

The two derived function blocks differ only in their internal memory management. FB_JsonDomParser [} 15] is optimized for the fast and efficient parsing and creation of JSON documents that are only changed a little.

It takes up less memory space than FB_DynDomParser [} 44] and is faster, but it consumes new memory with each change (e.g. SetObject [} 43]). This allocated memory is only released again by calling the method NewDocument [} 33].

3.1.1 AddArrayMember

This method adds an array member to a JSON object.

3.1.2 AddBase64Member

This method adds a Base64 member to a JSON object. A structure, for example, can be addressed as an input parameter. The corresponding Base64 coding is done by the method.

3.1.3 AddBoolMember

This method adds a Bool member to a JSON object.

3.1.4 AddDateTimeMember

This method adds a DateTime member to a JSON object.

3.1.6 AddDoubleMember

This method adds a Double member to a JSON object.

3.1.7 AddFileTimeMember

This method adds a FileTime member to a JSON object.

3.1.8 AddHexBinaryMember

This method adds a HexBinary member to a JSON object.

3.1.9 AddInt64Member

This method adds an Int64 member to a JSON object.

3.1.11 AddJsonMember

This method adds a JSON member to a JSON object.

3.1.12 AddNullMember

This method adds a NULL member to a JSON object.

3.1.13 AddObjectMember

This method adds an Object member to a JSON object.

3.1.14 AddStringMember

This method adds a String member to a JSON object.

3.1.15 AddUint64Member

This method adds an UInt64 member to a JSON object.

3.1.17 ArrayBegin

This method returns the first element of an array and can be used together with the methods ArrayEnd() and NextArray() for iteration through a JSON array.

3.1.19 ClearArray

This method deletes the content of an array.

3.1.20 CopyDocument

This method copies the contents of the DOM memory into a variable of data type STRING, which can have any length. The method returns the length of the string (including null termination). If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.1.21 CopyJson

This method extracts a JSON object from a key and stores it in a variable of data type STRING. This STRING can be of any length. The method returns the length of the copied JSON object (including null termination). If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.1.22 CopyString

This method copies the value of a key into a variable of the data type STRING, which can be of any length.

The method returns the length of the copied string (including null termination). If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.1.23 FindMember

This method searches for a specific property in a JSON document and returns it. 0 is returned if no corresponding property is found.

3.1.24 FindMemberPath

This method searches for a specific property in a JSON document and returns it. The property is specified according to its path in the document. 0 is returned if no corresponding property is found.

3.1.25 GetArraySize

This method returns the number of elements in a JSON array.

3.1.26 GetArrayValue

This method returns the value at the current iterator position of an array.

3.1.27 GetArrayValueByIdx

This method returns the value of an array in a specified index.

3.1.28 GetBase64

This method decodes a Base64 value from a JSON property. If the content of a data structure, for example, is located behind the Base64 value, the decoded content can also be placed on an identical structure again.

3.1.29 GetBool

This method returns the value of a property of the data type BOOL.

3.1.30 GetDateTime

This method returns the value of a property of the data type DATE_AND_TIME.

3.1.32 GetDocument

This method returns the content of the DOM memory as the data type STRING(255). With longer strings, the method will return a NULL string. In this case the method CopyDocument [} 21]() must be used.

3.1.33 GetDocumentLength

This method returns the length of a JSON document in the DOM memory.

3.1.34 GetDocumentRoot

This method returns the root node of a JSON document in the DOM memory.

3.1.35 GetDouble

This method returns the value of a property of the data type LREAL.

3.1.36 GetFileTime

This method returns the value of a property of the data type DCTIME.

3.1.37 GetHexBinary

This method decodes the HexBinary content of a property and writes it to a certain memory address, e.g. to

a data structure.

3.1.38 GetInt

This method returns the value of a property of the data type DINT.

3.1.40 GetJson

This method returns the value of a property as data type STRING(255), if this is a JSON document itself.

With longer strings, the method will return a NULL string. In this case the method CopyJson [} 21]() must be used.

3.1.41 GetJsonLength

This method returns the length of a property if this is a JSON document.

3.1.42 GetMaxDecimalPlaces

This method returns the current setting for MaxDecimalPlaces. This influences the number of decimal places in the case of floating point numbers.

3.1.43 GetMemberName

This method returns the name of a JSON property member at the position of the current iterator, e.g. during the iteration of a child element of a JSON property with the methods MemberBegin(), MemberEnd() and NextMember().

3.1.45 GetString

This method returns the value of a property of the data type STRING(255). With longer strings, the method will return a NULL string. In this case the method CopyString [} 22]() must be used.

3.1.46 GetStringLength

This method returns the length of a property if its value is a string.

3.1.47 GetType

This method returns the type of a property value. The return value can assume one of the values of the enum EJsonType.

3.1.48 GetUint

This method returns the value of a property of the data type UDINT.

3.1.50 HasMember

This method checks whether a certain property is present in the DOM memory. If the property is present the method returns TRUE, otherwise it returns FALSE.

3.1.51 IsArray

This method checks whether a given property is an array. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.52 IsBase64

This method checks whether the value of a given property is of the data type Base64. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.55 IsFalse

This method checks whether the value of a given property is FALSE. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.56 IsHexBinary

This method checks whether the value of a property is in the HexBinary format. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.57 IsInt

This method checks whether the value of a given property is of the data type Integer (PLC: DINT). If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.59 IsISO8601TimeFormat

This method checks whether the value of a given property has a time format according to ISO8601. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.60 IsNull

This method checks whether the value of a given property is NULL. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.61 IsNumber

This method checks whether the value of a given property is a numerical value. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.62 IsObject

This method checks whether the given property is a further JSON object. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.63 IsString

This method checks whether the value of a given property is of the data type STRING. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.64 IsTrue

This method checks whether the value of a given property is TRUE. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.65 IsUint

This method checks whether the value of a given property is of the data type UDINT. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.1.67 LoadDocumentFromFile

This method loads a JSON document from a file. A rising edge on the input parameter bExec triggers the loading procedure. Following the successful loading of a file, the return value of the method jumps to TRUE for one cycle and is then automatically reset by the driver.

3.1.68 MemberBegin

This method returns the first child element below a JSON property and can be used by a JSON property together with the methods MemberEnd() and NextMember() for iteration.

3.1.70 NewDocument

This method generates a new empty JSON document in the DOM memory.

3.1.71 NextArray

3.1.72 ParseDocument

This method loads a JSON object into the DOM memory for further processing. The JSON object takes the form of a string and is transferred to the method as an input. A reference to the JSON document in the DOM memory is returned to the caller.

3.1.73 PushbackBase64Value

This method appends a Base64 value to the end of an array. A structure, for example, can be addressed as an input parameter. The corresponding Base64 coding is done by the method.

3.1.74 PushbackBoolValue

This method appends a value of the data type BOOL to the end of an array.

3.1.75 PushbackDateTimeValue

This method appends a value of the data type DATE_AND_TIME to the end of an array.

3.1.78 PushbackFileTimeValue

This method appends a value of the data type FILETIME to the end of an array.

3.1.79 PushbackHexBinaryValue

This method appends a HexBinary value to the end of an array. The coding in the HexBinary format is executed by the method. A data structure, for example, can be used as the source.

3.1.80 PushbackInt64Value

This method appends a value of the data type Int64 to the end of an array.

3.1.82 PushbackJsonValue

This method appends a JSON document to the end of an array.

3.1.83 PushbackNullValue

This method appends a NULL value to the end of an array.

3.1.84 PushbackStringValue

This method appends a value of the data type DCTIME to the end of an array.

3.1.87 RemoveAllMembers

This method removes all child elements from a given property.

3.1.88 RemoveArray

This method deletes the value of the current array iterator.

3.1.89 RemoveMember

This method deletes the property at the current iterator.

3.1.90 RemoveMemberByName

This method removes a child element from a given property. The element is referenced by its name.

3.1.91 SaveDocumentToFile

This method saves a JSON document in a file. A rising edge at the input parameter bExec triggers the saving procedure. Following the successful saving of a file, the return value of the method jumps to TRUE for one cycle and is then automatically reset by the driver.

3.1.92 SetArray

This method sets the value of a property to the type "Array". New values can now be added to the array with the Pushback methods.

3.1.93 SetBase64

This method sets the value of a property to a Base64-coded value. A data structure, for example, can be used as the source. Coding to the Base64 format takes place inside the method.

3.1.94 SetBool

This method sets the value of a property to a value of the data type BOOL.

3.1.95 SetDateTime

This method sets the value of a property to a value of the data type DATE_AND_TIME.

3.1.97 SetDouble

This method sets the value of a property to a value of the data type Double.

3.1.98 SetFileTime

This method sets the value of a property to a value of the data type FILETIME.

3.1.99 SetHexBinary

This method sets the value of a property to a HexBinary-coded value. A data structure, for example, can be used as the source. Coding to the HexBinary format takes place inside the method.

3.1.100 SetInt

This method sets the value of a property to a value of the data type INT.

3.1.102 SetJson

This method inserts a further JSON document into the value of a property.

3.1.103 SetMaxDecimalPlaces

This method sets the current setting for MaxDecimalPlaces. This sets the maximum number of decimal places to be used with floating point numbers.

3.1.104 SetNull

This method sets the value of a property to the value NULL.

3.1.105 SetObject

This method sets the value of a property to the type "Object". This enables the nesting

3.1.106 SetString

This method sets the value of a property to a value of the data type STRING.

3.2 FB_JsonDynDomParser

This function block is derived from the same internal function block as FB_JsonDomParser [} 15] and thus offers the same interface.

The two derived function blocks differ only in their internal memory management. FB_JsonDynDomParser is optimized for JSON documents to which many changes are made. It releases the allocated memory again after the execution of an action (e.g. SetObject [} 43]).

3.3 FB_JsonSaxReader

3.3.1 DecodeBase64

This method converts a Base64-formated string to binary data. If the conversion was successful the method returns TRUE, otherwise it returns FALSE.

3.3.2 DecodeDateTime

This method enables the generation of a PLC variable of the type DATE_AND_TIME or DT from a standardized ISO8601 time format (e.g. YYYY-MM-DDThh:mm:ss). DT corresponds to the number of seconds starting from the date 01/01/1970. If the conversion was successful the method returns TRUE, otherwise it returns FALSE.

3.3.3 DecodeDcTime

This method enables the generation of a PLC variable of the type DCTIME from a standardized ISO8601 time format (e.g. YYYY-MM-DDThh:mm:ss). DCTIME corresponds to the number of nanoseconds starting from the date 01/01/2000. If the conversion was successful the method returns TRUE, otherwise it returns FALSE.

3.3.5 DecodeHexBinary

This method converts a string containing hexadecimal values into binary data. If the conversion was successful the method returns TRUE, otherwise it returns FALSE.

3.3.6 GetLastParseResult

3.3.7 IsBase64

This method checks whether the transferred string corresponds to the Base64 format. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.3.8 IsHexBinary

This method checks whether the transferred string consists of hexadecimal values. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.3.9 IsISO8601TimeFormat

This method checks whether the transferred string corresponds to the standardized ISO8601 time format. If that is the case, the method returns TRUE, otherwise it returns FALSE.

3.3.10 Parse

This method starts the SAX reader parsing procedure. The JSON object to be parsed and a reference to a function block, which was derived from the interface ITcJsonSaxHandler, are transferred as input parameters. This function block is then used for the callback methods of the SAX reader.

3.3.11 ParseValues

This method starts the SAX reader parsing procedure. The JSON object to be parsed and a reference to a function block, which was derived from the interface ITcJsonSaxValues, are transferred as input parameters.

This function block is then used for the callback methods of the SAX reader. What is special about this method is that exclusively values are taken into account in the callback methods, i.e. there are no OnKey() or OnStartObject() callbacks.

3.4 FB_JsonSaxWriter

3.4.1 AddBase64

This method adds a value of the data type Base64 to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.2 AddBool

This method adds a value of the data type BOOL to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.3 AddDateTime

This method adds a value of the data type DATE_AND_TIME to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.7 AddHexBinary

This method adds a hex binary value to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.8 AddKey

This method adds a new property key at the current position of the SAX writer. The value of the new property is usually set afterwards. This can be done using one of the following methods, for example: AddBase64[} 47], AddBool [} 48], AddDateTime [} 48], AddDcTime [} 48], AddDint [} 48], AddFileTime [} 49],AddHexBinary [} 49], AddLint [} 52], AddLreal [} 52], AddNull [} 52], AddRawArray [} 52],AddRawObject [} 53], AddReal [} 53], AddString [} 53], AddUdint [} 53], AddUlint [} 54].

3.4.9 AddKeyBool

This method creates a new property key and at the same time a value of the data type BOOL.

3.4.10 AddKeyDateTime

This method creates a new property key and at the same time a value of the data type DATE_AND_TIME.

3.4.14 AddKeyNull

This method creates a new property key and initializes its value with zero.

3.4.15 AddKeyNumber

This method creates a new property key and at the same time a value of the data type DINT.

3.4.17 AddLint

This method adds a value of the data type LINT to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.19 AddNull

This method adds the value zero to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.20 AddRawArray

This method adds a valid JSON array to a given property as a value. The array to be added must be in a valid JSON format and may only be added if the SAX writer is at a correspondingly valid position, i.e. for example, directly after a preceding AddKey() [} 49], StartArray() [} 55] or as the first call after a ResetDocument() [} 55].

3.4.22 AddReal

This method adds a value of the data type REAL to a property. Usually, a corresponding property was created beforehand with the method AddKey() [} 49].

3.4.26 CopyDocument

This method copies the content of the current JSON object created with the SAX Writer to a target variable of the data type STRING, which can be of any length. The method returns the length of the string (including null termination). If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.4.27 EndArray

This method generates the end of a started JSON array ("square closing bracket") and inserts it at the current position of the SAX writer.

3.4.28 EndObject

This method generates the end of a started JSON object ("curly closing bracket") and inserts it at the current position of the SAX writer.

3.4.29 GetDocument

This method returns the content of the JSON object that is currently created with the SAX Writer and returns it as data type STRING(255).

The maximum size of the string returned by the method is 255 characters. With longer strings, the method will return a NULL string. In this case the method CopyDocument [} 54]() must be used.

3.4.30 GetDocumentLength

This method returns the length of the JSON object that is currently created with the SAX Writer and returns it as data type UDINT.

3.4.31 GetMaxDecimalPlaces

3.4.32 ResetDocument

This method resets the JSON object currently created with the SAX writer.

3.4.33 SetMaxDecimalPlaces

3.4.34 StartArray

This method generates the start of a new JSON array ("square opening bracket") and inserts it at the current position of the SAX writer.

3.4.35 StartObject

This method generates the start of a new JSON object ("curly opening bracket") and inserts it at the current position of the SAX writer.

3.5 FB_JsonReadWriteDataType

3.5.1 AddJsonKeyPropertiesFromSymbol

With the aid of this method, metadata can be added via PLC attributes to the JSON representation of a PLC data structure on an FB_JsonSaxWriter [} 47] object. The method receives as its input parameters the instance of the FB_JsonSaxWriter function block, the desired name of the JSON property that is to contain the metadata, the data type name of the structure and a string variable sProperties, which contains a list of the PLC attributes to be extracted, separated by a cross bar.

3.5.2 AddJsonKeyValueFromSymbol

This method generates the JSON representation of a PLC data structure on an FB_JsonSaxWriter [} 47]object. The method receives as its input parameters the instance of the FB_JsonSaxWriter function block,the data type name of the structure, and the address and size of the source structure instance. As a result,the FB_JsonSaxWriter instance contains a valid JSON representation of the structure. Unlike the method AddJsonValueFromSymbol() [} 57], the elements of the source structure are nested here in a JSON subobject whose name can be specified via the input/output parameter sKey.

3.5.3 AddJsonValueFromSymbol

This method generates the JSON representation of a PLC data structure on an FB_JsonSaxWriter [} 47] object. The method receives as its input parameters the instance of the FB_JsonSaxWriter function block,the data type name of the structure, and the address and size of the source structure instance. As a result, the FB_JsonSaxWriter instance contains a valid JSON representation of the structure.

3.5.4 CopyJsonStringFromSymbol

This method generates the JSON representation of a symbol and copies it into a variable of the data type STRING, which can be of any length. The method returns the length of the string (including null termination).

If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.5.5 CopyJsonStringFromSymbolProperties

This method generates a corresponding JSON representation of PLC attributes on a symbol. In contrast to the AddJsonKeyPropertiesFromSymbol [} 56] method, the result is not written to an instance of the function block FB_JsonSaxWriter, but to a string variable. The method receives as its input parameters the data type name of the symbol and a string variable that represents a list of the PLC attributes to be extracted, separated by a cross bar.

The method copies this JSON representation into a variable of the data type STRING, which can be of any length. The method returns the length of the string (including null termination). If the target buffer is too small, it is emptied by a null termination and returned as length 0.

3.5.6 GetDataTypeNameByAddress

This method returns the data type name of a transferred symbol.

3.5.7 GetJsonFromSymbol

This method generates the corresponding JSON representation of a symbol. In contrast to the AddJsonValueFromSymbol() [} 57] method, the result is not written to an instance of the function block FB_JsonSaxWriter, but to a string variable. The method receives as its input parameters the data type name of the symbol as well as the address and size of the source symbol, e.g. of a structure instance. The address and size of the destination buffer that contains the JSON representation of the symbol after the call are transferred as further input parameters.

3.5.8 GetJsonStringFromSymbol

This method generates the corresponding JSON representation of a symbol. In contrast to the AddJsonValueFromSymbol() [} 57] method, the result is not written to an instance of the function block FB_JsonSaxWriter, but to a string variable. The method receives as its input parameters the data type name of the symbol as well as the address and size of the source symbol, e.g., of a structure instance.

The maximum size of the string returned by the method is 255 characters. With longer strings, the method will return a NULL string. In this case the method CopyJsonStringFromSymbol [} 57]() must be used.

3.5.9 GetJsonStringFromSymbolProperties

This method generates a corresponding JSON representation of PLC attributes on a symbol. In contrast to the AddJsonKeyPropertiesFromSymbol [} 56] method, the result is not written to an instance of the function block FB_JsonSaxWriter, but to a string variable. The method receives as its input parameters the data type name of the symbol and a string variable that represents a list of the PLC attributes to be extracted, separated by a cross bar. The result is returned directly as the return value of the method.

The maximum size of the string returned by the method is 255 characters. With longer strings, the method will return a NULL string. In this case the method CopyJsonStringFromSymbolProperties [} 58]() must be used.

3.5.10 GetSizeJsonStringFromSymbol

This method reads the size of the JSON representation of a symbol. The value is specified with null termination.

3.5.11 GetSizeJsonStringFromSymbolProperties

This method reads the size of the JSON representation of PLC attributes on a symbol. The value is specified with null termination.

3.5.12 GetSymbolNameByAddress

This method returns the complete (ADS) symbol name of a transferred symbol.

3.5.13 SetSymbolFromJson

This method extracts a string containing a valid JSON message and attempts to save the contents of the JSON object to an equivalent data structure. The method receives as its input parameters the string with the JSON object, the data type name of the target structure, and the address and size of the target structure instance.

3.6 FB_XmlDomParser

3.6.1 AppendAttribute

This method adds a new attribute to an existing node. The name and value of the new attribute and the existing XML node are transferred to the method as input parameters. The method returns a reference to the newly added attribute.

3.6.2 AppendAttributeAsBool

This method adds a new attribute to an existing node. The value of the attribute has the data type Boolean.

The name and value of the new attribute and the existing XML node are transferred to the method as input parameters. The method returns a reference to the newly added attribute.

3.6.9 AppendAttributeCopy

This method adds a new attribute to an existing node. The name and value of the new attribute are copied from an existing attribute. The existing attribute is transferred to the method as input parameter.

3.6.10 AppendChild

This method inserts a new node below an existing node. The value of the new node has the data type STRING. The name and value of the new node and a reference to the existing node are transferred to the method as input parameters. The method returns a reference to the newly added node. The input parameter cdata indicates whether the value of the node is to be encapsulated in a CDATA function block, so that certain special characters such as "<" and ">" are allowed as values.

3.6.11 AppendChildAsBool

This method inserts a new node below an existing node. The value of the new node has the data type Boolean. The name and value of the new node and a reference to the existing node are transferred to the method as input parameters. The method returns a reference to the newly added node.

3.6.13 AppendChildAsFloat

This method inserts a new node below an existing node. The value of the new node has the data type Float.

The name and value of the new node and a reference to the existing node are transferred to the method as input parameters. The method returns a reference to the newly added node.

3.6.18 AppendCopy

This method inserts a new node below an existing node. The name and value of the new node are copied from an existing node. The references to the existing nodes are transferred to the method as input parameters. The method returns a reference to the newly added node.

3.6.19 AppendNode

This method adds a new node to an existing node. The existing node and the name of the new node are transferred to the method as input parameters. The method returns a reference to the newly added node.

3.6.20 Attributes

This method can be used to read the attribute of a given XML node. The XML node and the name of the attribute are transferred to the method as input parameters. After the method has been called, further methods have to be called, for example to read the value of the attribute, e.g. AttributeAsInt().

3.6.21 AttributeAsBool

This method returns the value of an attribute as data type Boolean. The attribute is transferred to the method as input parameter.

3.6.28 AttributeBegin

This method returns an iterator over all attributes of an XML node. The XML node is transferred to the method as input parameter.

3.6.29 AttributeFromIterator

This method converts the current position of an iterator to an XML attribute object. The iterator is transferred to the method as input parameter.

3.6.30 AttributeName

This method returns the name of a given attribute. The attribute is transferred to the method as input parameter.

3.6.31 Attributes

This method is used to navigate through the DOM and returns an iterator for all attributes found at an XML node. The iterator can then be used for further navigation through the elements that were found. The node and a reference to the iterator are transferred to the method as input parameters.

3.6.32 AttributeText

This method returns the text of a given attribute. The attribute is transferred to the method as input parameter.

3.6.33 Begin

This method returns an iterator over all child elements of an XML node, always starting from the first child element. The XML node is transferred to the method as input parameter.

3.6.34 BeginByName

This method returns an iterator over all child elements of an XML node, starting at a particular element. The XML node is transferred to the method as input parameter.

3.6.35 Child

This method is used to navigate through the DOM. It returns a reference to the (first) child element of the current node. The start node is transferred to the method as input parameter.

3.6.36 ChildByAttribute

This method is used to navigate through the DOM. It returns a reference to a child element in the XML document. The start node and the name and value of the attribute are transferred to the method as input parameters.

3.6.37 ChildByAttributeAndName

This method is used to navigate through the DOM. It returns a reference to a child element in the XML document. The start node, the name and value of the attribute, and the name of the child element are transferred to the method as input parameters.

3.6.38 ChildByName

This method is used to navigate through the DOM. It returns a reference to a child element in the XML document. The start node and the name of the element to be returned are transferred to the method as input parameters.

3.6.39 Children

This method is used to navigate through the DOM. It returns an iterator for several child elements found in the XML document. The iterator can then be used for further navigation through the elements that were found. The start node and a reference to the iterator are transferred to the method as input parameters.

3.6.40 ChildrenByName

This method is used to navigate through the DOM. It returns an iterator for several child elements found in the XML document. The iterator can then be used for further navigation through the elements that were found. The start node, the name of the child elements to be found and a reference to the iterator are transferred to the method as input parameters.

3.6.41 Compare

This method checks two iterators for equality.

3.6.42 CopyAttributeText

This method reads the value of an XML attribute and writes it to a variable of data type String. The XML attribute, the target variable and the length to be written are transferred to the method as input parameters.

The method returns the actual size.

3.6.43 CopyDocument

This method copies the contents of the DOM memory into a variable of the data type String. The length to be written and the variable into which the resulting string is to be written are transferred to the method as input parameters. The method returns the actually written length. Note that the size of the string variable is at least equal to the size of the XML document in the DOM.

3.6.44 CopyNodeText

This method reads the value of an XML node and writes it to a variable of data type String. The XML node, the target variable and the length to be written are transferred to the method as input parameters. The method returns the actual size.

3.6.45 CopyNodeXml

This method reads the XML structure of an XML node and writes it to a variable of data type String. The XML node, the target variable and the length to be written are transferred to the method as input parameters. The method returns the actual size.

3.6.46 FirstNodeByPath

This method navigates through an XML document using a path that was transferred to the method. The path and the start node are transferred to the method as input parameters. The path is specified with "/" as separator. The method returns a reference to the XML node that was found.

3.6.47 GetAttributeTextLength

This method returns the length of the value of an XML attribute. The XML attribute is transferred to the method as input parameter.

3.6.48 GetDocumentLength

This method returns the length of an XML document in bytes.

3.6.49 GetDocumentNode

This method returns the root node of an XML document. This is not the same as the first XML node in the document (the method GetRootNode() should be used for this). The method can also be used to create an empty XML document in the DOM.

3.6.50 GetNodeTextLength

This method returns the length of the value of an XML node. The XML node is transferred to the method as input parameter.

3.6.52 GetRootNode

This method returns a reference to the first XML node in the XML document.

3.6.53 InsertAttributeCopy

This method adds an attribute to an XML node. The name and value of an existing attribute are copied. The attribute can be placed at a specific position. The XML node, the position and a reference to the existing attribute object are transferred to the method as input parameters. The method returns a reference to the newly added attribute.

3.6.54 InsertAttribute

This method adds an attribute to an XML node. The attribute can be placed at a specific position. The XML node and the position and name of the new attribute are transferred to the method as input parameters. The method returns a reference to the newly added attribute. A value for the attribute can then be entered using the SetAttribute() method, for example.

3.6.55 InsertChild

This method adds a node to an existing XML node. The new node can be placed at a specific location. The existing XML node and the position and name of the new node are transferred to the method as input parameters. The method returns a reference to the newly added node. A value for the node can then be entered using the SetChild() method, for example.

3.6.56 InsertCopy

This method adds a new node to an existing XML node and copies an existing node. The new node can be placed anywhere in the existing node. The XML node, the position and a reference to the existing node object are transferred to the method as input parameters. The method returns a reference to the newly added node.

3.6.57 IsEnd

This method checks whether a given XML iterator is at the end of the iteration that is to be performed.

3.6.58 LoadDocumentFromFile

This method loads an XML document from a file. The absolute path to the file is transferred to the method as input parameter. A rising edge on the input parameter bExec triggers the loading procedure. Following the successful loading of a file, the return value of the method jumps to TRUE for one cycle and is then automatically reset by the driver.

3.6.59 NewDocument

This method creates an empty XML document in the DOM memory.

3.6.60 Next

This method sets an XML iterator for the next object that is to be processed.

3.6.61 NextAttribute

This method returns the next attribute for a given XML attribute.

3.6.62 NextByName

This method sets an XML iterator for the next object that is to be processed, which is identified by its name.

3.6.63 NextSibling

This method returns the next direct node for a given XML node at the same XML level.

3.6.64 NextSiblingByName

This method returns the next direct node for a given XML node with a particular name at the same XML level.

3.6.65 Node

This method is used in conjunction with an iterator to navigate through the DOM. The iterator is transferred to the method as input parameter. The method then returns the current XML node as return value.

3.6.66 NodeAsBool

This method returns the text of an XML node as data type Boolean. The XML node is transferred to the method as input parameter.

3.6.73 NodeName

This method returns the name of an XML node. A reference to the XML node is transferred to the method as input parameter.

3.6.74 NodeText

This method returns the text of an XML node. The XML node is transferred to the method as input parameter.

3.6.75 ParseDocument

This method loads an XML document into the DOM memory for further processing. The XML document exists as a string and is transferred to the method as input parameter. A reference to the XML document in the DOM is returned to the caller.

3.6.76 RemoveChild

This method removes an XML child node from a given XML node. The two XML nodes are transferred to the method as input parameters. The method returns TRUE if the operation was successful and the XML node was removed.

3.6.77 RemoveChildByName

This method removes an XML child node from a given XML node. The node to be removed is addressed by its name. If there is more than one child node, the last child node is removed. The method returns TRUE if the operation was successful and the XML node was removed.

3.6.78 SaveDocumentToFile

This method saves the current XML document in a file. The absolute path to the file is transferred to the method as input parameter. A rising edge at the input parameter bExec triggers the saving procedure.

Following the successful saving of a file, the return value of the method jumps to TRUE for one cycle and is then automatically reset by the driver.

3.6.79 SetAttribute

This method sets the value of an attribute. The value has the data type String.

3.6.80 SetAttributeAsBool

This method sets the value of an attribute. The value has the data type Boolean.

3.6.82 SetAttributeAsFloat

This method sets the value of an attribute. The value has the data type Float.

3.6.87 SetChild

This method sets the value of an XML node. The value is transferred to the method as input parameter of data type String. The input parameter cdata indicates whether the value of the node is to be encapsulated in a CDATA function block, so that certain special characters such as "<" and ">" are allowed as values.

3.6.88 SetChildAsBool

This method sets the value of an XML node. The value is transferred to the method as input parameter of data type Boolean.

3.7 FB_JwtEncode

The function block enables the creation and signing of a JSON Web Token (JWT)

4 Interfaces

4.1 ITcJsonSaxHandler

4.1.1 OnBool

This callback method is triggered if a value of the data type BOOL was found at the position of the SAX reader. The input parameter value contains the value found. The SAX parsing procedure is aborted by setting the return value HRESULT to S_FALSE.

(0)

相关推荐