ST_XmlItem

Overview

Type:

Structure

Available as of:

V1.0.8.0

Inherits from:

-

Description

The structure ST_XmlItem is used to describe an element or an attribute that is read from or written to an XML file.

Structure Elements

Name

Data type

Description

diParentIndex

DINT

Indicates the index of the array where the parent element of the XML item is located (refer to Example for Hierarchical Relations Indicated by uiParentIndex).

NOTE: The value of -1 indicates the root element and is reserved for the very first item of the array.

sName

STRING[GPL.Gc_uiXmlLengthOfString]

Name of the element or attribute.

sValue

STRING[GPL.Gc_uiXmlLengthOfString]

Value of the element or attribute.

etType

ET_XmlItemType

Indicates the type of the XML item.

uiNumOfAttributes

ULINT

This value depends on the type of the XML item:

  • If the item is of type element, then the value indicates the number of associated attributes.

  • If the item is of type attribute, then the value indicates the sequential number.

Used By

  • XmlItems

Example for Hierarchical Relations Indicated by uiParentIndex

The example illustrates the correlation between the parameter uiParentIndex in the buffer of type XmlItems provided by the application and the hierarchical structure in the XML document.

XML document

Buffer of type XmlItems provided by the application

<?xml version="1.0" encoding="ASCII"?>
<AAA>
   <BBB />
   <CCC />
     <DDD>
       <EEE />
     </DDD>
</AAA>

Element

Parent index

Explanation

AAA

–1

AAA is the root element. It has no parent.

BBB

0

AAA is the parent element. It is stored in array index 0.

CCC

0

DDD

0

EEE

3

DDD is the parent element. It is stored in array index 3.