obj_loadΒΆ
obj_load loads an object saved with obj_save from the hard drive.
-
e = obj_load(obj, ssFilename)
-
e = obj_load(obj, ssString)
-
e = obj_load(obj, ssFileOrString, bString)
Return Value
e is an error object (see error_create) if an error occurred of 0 if the function was successful.
Parameters
-
obj
obj is the object created with obj_create.
-
ssFilename
ssFilename is the complete file name of the saved object.
-
ssFileOrString
ssFileOrString is the complete file name or a string with XML code saved using obj_save.
-
bString
If the function is invoked with the XML code, bString must be set to 1.
Example
obj = obj_create()
obj.a = 123
obj.b = "Hello"
obj.save("c:/test.xml");
obj2 = obj_create()
e = obj2.load("c:/test.xml")
if (e) {
MessageBoxError(e.message);
}
Example 2:
* o = [. a = 123, "Hello"]
* o
[.
[1] = "Hello"
a = 123
]
object (obj at 0x3E0DB38)
* r = o.save("")
* r
<?xml version='1.0' encoding='utf-8'?>
<obj id='1'>
<string ikey='1'>Hello</string>
<number key='a'>123</number>
</obj>
* o1 = [.]
* o1.load(r, 1)
0.0000
* o1
[.
[1] = "Hello"
a = 123
]
Comment
The function can also load map files created with MapSave.
Elements already existing the object will be overwritten by elements saved in the XML file. Elements existing in the object but not in the XML file are not removed or modified.
History
Version | Description |
---|---|
R2014.3 | Objects saved with obj_save in binary format can be loaded. |
5.10.0 | New parameter bString. |
4.1.0 | New |
See also
id-213018