Sets the value of the specified element. The parameter elementPath is specified as a path of element names.
To reference multiple elements with the same elementPath, use bracket notation, as in the example.
FUNCTION SetElementValue(
XMLHandle : LONGINT;
elementPath : STRING;
value : STRING):INTEGER;def vs.SetElementValue(XMLHandle, elementPath, value):
return INTEGER| Name | Type | Description |
|---|---|---|
| XMLHandle | LONGINT | |
| elementPath | STRING | |
| value | STRING |
PROCEDURE Example;
CONST
xmlFileName = 'C:XML Test File.xml';
VAR
i :INTEGER;
hXML :LONGINT;
result :INTEGER;
BEGIN
hXML := InitXML;
result := CreateNewXMLDocument(hXML, 'XmlRoot');
FOR i := 1 TO 3 DO BEGIN
result := SetElementValue(hXML, Concat('/XmlRoot/list/loc[', i, ']'), Concat('i=',i));
result := SetElementValue(hXML, Concat('/XmlRoot/list/pos[', i, ']'), Concat('i=',i));
END;
result := WriteXMLFile(hXML, -1, xmlFileName);
Message('result: ', result);
result := ReleaseXML(hXML);
END;
RUN(Example);Availability: from All Versions
This is drop-in function.