Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Import XML content via Sheet Worker Script

1585665949
Loki
Sheet Author
Hi! For the system that I've created a character sheet for there is a very powerful tool to create characters. This tool saves the character sheets as xml. I added a  functionality to my sheet to import these characters. Since there is currently no option to upload a XML file via Roll20 (e.g. into the character vault) the user has to paste the character data into my sheet. Currently I make him convert the character from XML to JSON beforehand and then simply convert the string with JSON.parse(). Now I'd like to save the users the pain to converting the file and directly parse the XML into the character sheet. I made some research about how to parse XML with JavaScript and came across the DOMParser, but sadly the character sheet stops working if I declare one. For JSON handling there is the JSON-object that doesn't need to be declared and just works out of the box but I couldn't find anything equivalent for XML handling. Is there such option? How would you parse a raw XML text? Any help is very welcome!
1585666677
Andreas J.
Forum Champion
Sheet Author
Translator
JavaScript in sheetworkers is pretty limited, and you can't do anything with the DOM. More info: <a href="https://wiki.roll20.net/Building_Character_Sheets#Restrictions" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Restrictions</a> I think there is one existing character sheet that imports XML, but I could be wrong, didn't find it on a quick search of the repo.
1585690493

Edited 1585690594
vÍnce
Pro
Sheet Author
Andreas J. said: JavaScript in sheetworkers is pretty limited, and you can't do anything with the DOM. More info: <a href="https://wiki.roll20.net/Building_Character_Sheets#Restrictions" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#Restrictions</a> I think there is one existing character sheet that imports XML, but I could be wrong, didn't find it on a quick search of the repo. The Pathfinder Community Sheet includes a HeroLab import parser that handles HL's exported XML then converted to json.&nbsp; James W created the feature for the sheet. <a href="https://wiki.roll20.net/Pathfinder_Community_Sheet#HeroLab_Character_import" rel="nofollow">https://wiki.roll20.net/Pathfinder_Community_Sheet#HeroLab_Character_import</a>
1585731223
Loki
Sheet Author
Hi! Thanks for your replies! Given the instructions in the linked page from Vince that importer also requires converting the XML in JSON format beforehand - so it works exactly like the already existing converter in this regard. Well, I guess it is what it is. Thank you again for your attention. :-) Cheers!
1585824020

Edited 1585824034
Andreas J.
Forum Champion
Sheet Author
Translator
It seems the Splittermond sheet will get a XML importer next week. Is this what you were working on, or a coincidence? What's the sheet/game your doing this for?
1585864237
Loki
Sheet Author
Yes, that is indeed my project. I've created the sheet for Splittermond (which is a rather popular german high fantasy setting).