Edit: I think I found out roughly how to do it. The syntax is kind of picky. If you do things in the wrong order, the XML can turn out a little bit different.
"Example
renoise.Document.create("Song") {
file_path = "full path",
bpm = 126
}
songs = renoise.Document.DocumentList()
hist = renoise.Document.create("SongHistory") {
Songs = songs
}
-- create song instances
song2 = renoise.Document.instantiate("Song")
song3 = renoise.Document.instantiate("Song")
song2:property("file_path").value = "testpath"
song3:property("file_path").value = "another path"
-- add to document list
songs:insert(song2)
songs:insert(song3)
-- test save and load
hist:save_as("history_new.xml")
hist:load_from("history_new.xml")
print(hist:property("Songs")[2]:property("file_path").value)
OP:
Regarding renoise.Document:
Is it possible to use the save_as/load_from methods to load XML files with more than one depth? (example below). Since renoise.DocumentList don’t have those methods, maybe not?
I’ve also tried to construct the document by using a template table without success. And I’ve tried to load a manually made XML to no avail. I’m guessing that the only extra depth possible for lists is the one provided by ObservableBool/Number/StringList ?
I could workaround by starting to name the elements “Element1”, “Element2” et c, but wanted to check here first if it’s possible to achieve what I want.
XML example
<?xml version="1.0" encoding="UTF-8"?>
<SongHistory doc_version="0">
<Songs>
<Song>
<bpm>0.0</bpm>
<instr_no>0.0</instr_no>
<last_updated> </last_updated>
<file_path> </file_path>
<rating>0.0</rating>
<comment> </comment>
<seq_no>0.0</seq_no>
</Song>
<Song>
<bpm>0.0</bpm>
<instr_no>0.0</instr_no>
<last_updated> </last_updated>
<file_path> </file_path>
<rating>0.0</rating>
<comment> </comment>
<seq_no>0.0</seq_no>
</Song>
</Songs>
</SongHistory>