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
This post has been closed. You can still view previous posts, but you can't post any new replies.

Xpath compliant DOM parser?

1446603284
jflo
API Scripter
Is there any chance we could get access to an XPath compliant DOM parser in the API? I'm trying to build an import script to pull in Chummer5a build files for Shadowrun games. It'd be nice to not have to convert those to JSON first, plus XPath is a much better way to work with the data that Chummer renders.
1446606680
Gen Kitty
Forum Champion
For your suggestions we offer the Suggestions & Ideas forum, based on voting from the whole community. Please review our Forum Voting wiki page for more information on how voting works, and our Suggestions & Ideas Posting Guidelines for the added expectations above and beyond our standard Code of Conduct .
1446608585
Lithl
Pro
Sheet Author
API Scripter
I haven't tested it, but this looks promising:&nbsp; <a href="https://github.com/dimagi/js-xpath" rel="nofollow">https://github.com/dimagi/js-xpath</a> It would need some edits, such as changing console.log to log, but at a glance it doesn't appear to be relying on functionality unavailable to the API such as the document object.
1446643542
jflo
API Scripter
Moved thread here: &nbsp; <a href="https://app.roll20.net/forum/post/2591721/xpath-co" rel="nofollow">https://app.roll20.net/forum/post/2591721/xpath-co</a>... Thanks!
1446661012
jflo
API Scripter
Thanks for the suggestion @Brian but the project linked is for parsing Xpath statements. What I'm actually looking for is a DOM parser that I can feed the raw xml to, get back a DOM, and then execute XPath against to read out specific values and assign to attributes.&nbsp; I think my next attempt will be to find a way to take the XML and just convert to JSON and then skip the XPath part. It's a pity, because this will introduce lots of loops and conditionals based on the way Chummer structures its xml. &nbsp;I'll also investigate jspath as well.
1446682360
Gen Kitty
Forum Champion
As you now have a suggestion thread, I'll go ahead and close this one.