ndless-nspire / Luna

Create TNS files from Lua and XML
Other
57 stars 13 forks source link

Templates for Document.xml and Problem.xml #19

Closed HoleInOneGolfer closed 1 month ago

HoleInOneGolfer commented 6 months ago

Templates for Document.xml and Problem.xml????

akpi816218 commented 2 months ago

Yup, need to know the format for the XML input document.

MaxBas commented 2 months ago

I would love that too, with all new nspire devices unsopported by ndless it is increasingly unaccessible to get the xml oneself. Therefore I would appriciate if one with os version < 5.4.0 could provide some xml files generated from simple problems such a how functions are saved, graphs (in different equations) and maybe other pages. If someone with said version requirement is willing to, I would greatly appriciate the effort.

Legimet commented 2 months ago

The XML format is proprietary and incredibly verbose, see the example of a simple "hello world" notes document. So no one here will be able to provide you with a complete specification. That said, here is a sample Document.xml. Replace the 1 in the <nps> tag with the number of Problem*.xml files. Beyond that, if you have a particular TNS file and you want the XML, I'd be happy to extract it for you.

MaxBas commented 2 months ago

I just moved so I'm a bit short on time, but once I've got time (maybe in like 1 or 2 weeks) I'll look into preparing a tns that should include most relevant stuff. Thanks for your help @Legimet :)

MaxBas commented 2 months ago

I would appreciate if you could convert some of mine :D I selected 5 that should cover most of the stuff I'm doing. conv.zip I'll still try to prepare one with more content once I've got the time

Legimet commented 2 months ago

Here you go: conv.zip

Edit: You can use xmllint to format the XML files so that they're more readable as follows: xmllint --format Problem1.xml | xmllint --c14n - > tmp.xml && mv tmp.xml Problem1.xml

The c14n option tells it to use the XML canonicalization format which, among other things, doesn't collapse empty tags like <a></a> to <a/> (the latter doesn't seem to work with ~the Nspire format~ Luna).

conv_formatted.zip

MaxBas commented 2 months ago

I would have formatted it using a N++ plugin before, but that seems way more convenient. Thanks for the conversion :)