I am looking for a modern syntax xml library for lua, which actually supports attributes. Does not require a dom parser or similar. So far only found this one:
But I need to do this in both directions, luatable2xml and xml2luatable… Any hint for me?
Also is there a way to use VSCode as IDE for Renoise development? Having autocomplete, autoformat, known Renoise base libs, etc, just the normal stuff? External source updating still does not seem to be supported…
Good point, maybe having xmlpath would be pretty handy.
Maybe this? GitHub - duhoobo/lua-xpath: A Lua XPath library based on libxml2.
But it reuqires libxml2, and it seems to me that I cannot use such modules in Renoise lua, seem to require another lua build… No luarocks support either.
Any idea for me?
Would probably just craft a regex to get it done; hth.
Agreed, more or less, on using a regex. Depending on your use case it may be simplest to iterate over a table and build up a string of XML.
The reverse may be trickier, but, again, if you control the XML (or know for sure what to expect) then hand-parsing might not be too bad.
But what’s the actual use case that you need this XML/table conversion? Maybe there’s some other way to do what you want.
FWIW I use vim for Renoise tool development, and have some Ruby scripts to package up the source files and update the tools in my Renoise folder.
regex is way too cumbersome. I need to build a very complex xml, based on song data, and also parse such a xml structure to build a renoise song. Using regex would turn this into an insane and also badly debuggable mess.
xpath might be a good idea, or maybe a dom parser would be actually a good idea then. But lua seems to be quite retarded here, or requires addional pre-compiled extensions here. Which are not part of Renoise’s lua component.
So it currently seems to be an immense amount of work to build a dawproject export/import, due limitations. But maybe I am wrong and you have some ideas here?
Can I set attributes with the Renoise document api, and traverse/search thru a xml?
Your original suggestion is bidirectional - XML to table and table to XML. This looks good enough for the task?
The “xpath support” I don’t quite understand. Isn’t it enough to just traverse/filter anything you need with custom lua after the import to table is done?
Maybe you are right about that. So I just need renoise document api capable of attributes? Any third party suggestion then?
Being able to use XPath or Dom queries might be more comfortable and future save though…
I would not care about the document API or xpath. If it’s simple enough to do with normal Lua, it seems rational to minimize unnecessary abstractions and dependencies.
If xml2lua(table) can be made up and running, I would guess the main hurdle will be fxb (vst data) and how to interpret audio tracks on import. Some things I guess will have to be stripped (warping data maybe?), but could possibly be stored/reused via tool_data to break as little as possible when moving between DAWs.
A nice nested class structure with separate import/export/render functions for the various XML node-types would make the code easy to maintain and understand.