method toXML

void toXML(stream stream);

Argumente

Zurückgegebener Wert

This method creates a XML UTF-8 encoding of the array values. The values in the array are unchanged. This allows an array to be passed around as text by calling rawStreamReader::readStringTillEndOfStream on the specified stream. The following value types are supported: double, int64, int64, uint32, int32, uint16, int16, uint8, int8, stream, string, time, bool, array, and dictionary. When stream is encountered, it is converted to base 64. The XML declaration is not included in the stream.

When the array contains an element type that is not supported by this method, it returns the EE_FAIL error.

var arrayObj = shell.serviceManager.basics.array;
arrayObj.addValue(42);
arrayObj.addValue("Hello World");

var users = shell.serviceManager.basics.array;
users.addValue("john");
users.addValue("tom");

arrayObj.addValue(users);
arrayObj.addValue(false);

var xmlStream = shell.serviceManager.basics.memoryStream;
arrayObj.toXML(xmlStream);
xmlStream.close();
/*
The resulting XML in the stream will look like this:
<array>
  <int32>42</int32>
  <string>Hello World</string>
  <array>
    <string>john</string>
    <string>tom</string>
  </array>
  <bool>false</bool>
</array>
*/