# Citeproc-js in worker threads

**URL:** <https://discourse.citationstyles.org/t/citeproc-js-in-worker-threads/1254>\
**Category:** CSL Development\
**Created:** [March 19, 2015, 10:38pm UTC](https://discourse.citationstyles.org/t/citeproc-js-in-worker-threads/1254 "2015-03-19T22:38:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Bennett](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/frank_bennett/32/198_2.png) [@Frank\_Bennett](https://discourse.citationstyles.org/u/Frank_Bennett)\
**Post date:** [March 19, 2015, 10:38pm UTC](https://discourse.citationstyles.org/t/citeproc-js-in-worker-threads/1254/1 "2015-03-19T22:38:48Z")

</div>

The citeproc-js bundle contains a parsing file named xmljson.js, added  
quite some time ago, after a conversation with Simon Kornblith.

In a browser environment, the xmljson.js parser makes it possible to  
run citeproc-js in a worker thread, where DOM methods are not  
permitted. Apart from converting the style and locale XML to  
JavaScript object form and installing the xmljson.js parser code, the  
processor is run in the usual way, with the JS objects used as drop-in  
replacements for the XML.

The missing piece to the puzzle has been the conversion method - for  
initial testing, I used locales and styles pre-converted with a Python  
script, which wasn’t terribly convenient for production. I recently  
had a need for a JS version of the converter, so here it is:

```
https://github.com/fbennett/csl-json-walker

```

It has a CC0 license, do with it what you will. Hope it makes things easier!

Frank

---

<div class="post-metadata">

**Author:** ![michelkraemer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/michelkraemer/32/226_2.png) [@michelkraemer](https://discourse.citationstyles.org/u/michelkraemer)\
**Post date:** [March 20, 2015, 6:02am UTC](https://discourse.citationstyles.org/t/citeproc-js-in-worker-threads/1254/2 "2015-03-20T06:02:50Z")

</div>

In relation to citeproc-js issue #120 [1] I think this is going to be  
very useful for citeproc-java! Thanks a lot for posting the tool! I’ll  
have a look at it over the weekend.

Cheers,  
Michel

[1]  
[https://bitbucket.org/fbennett/citeproc-js/issue/120/create-npm-package-for-nodejs](https://bitbucket.org/fbennett/citeproc-js/issue/120/create-npm-package-for-nodejs)

---

<div class="post-metadata">

**Author:** ![michelkraemer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.citationstyles.org/michelkraemer/32/226_2.png) [@michelkraemer](https://discourse.citationstyles.org/u/michelkraemer)\
**Post date:** [March 20, 2015, 6:05am UTC](https://discourse.citationstyles.org/t/citeproc-js-in-worker-threads/1254/3 "2015-03-20T06:05:05Z")

</div>

And for the npm package as well of course …

Cheers,  
Michel
