obj_save saves an object as an XML file on the hard drive or as a string.
Return Value
bool is not equal to 0 if the function was successful.
Parameters
obj is the object created with obj_create.
ssFilename is the complete file name.
ssFormat is a format string to specify the number format (see printf). The default value is "%.20g".
Example
obj = obj_create()
obj[1] = 123
obj.a = "Hello"
obj.c = obj_create()
obj.c.d = 456
obj.save("d:/test.xml")
creates the following xml file:
<?xml version='1.0' encoding='utf-8'?>
<obj ID='1'>
<number ikey='1'>123</number>
<string key='a'>Hello</string>
<obj ID='2' key='c'>
<number key='d'>456</number>
</obj>
</obj>
Comment
The function can also save nested objects with references, e.g.
obj = obj_create()
obj.val = 123
obj.next = obj_create()
obj.next.val = 456
obj.next.next = obj
obj.save
creates the follow xml file (note attributes id and ref):
<?xml version='1.0' encoding='utf-8'?>
<obj id='1'>
<obj id='2' key='next'>
<obj key='next' ref='1'/>
<number key='val'>456</number>
</obj>
<number key='val'>123</number>
</obj>
History
| Version | Description |
|---|---|
| 5.10.0 | |
| 5.0.0 | Unicode changes |
| 4.1.0 | New |
See also
id-699932