VS:SetElementValue

From Vectorworks Developer
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

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

Parameters

XMLHandle LONGINT
elementPath STRING
value STRING

Example

VectorScript

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);

Python


Version

Availability: from All Versions

This is drop-in function.