Example code for generating Crossref XML for DOI registration at the Wisconsin Geological and Natural History Survey. For sharing purposes only - this is not the live code that is run by WGNHS, as that is part of a larger application that also performs other actions.
This code uses the following example JSON files located in the input_files directory as input.
These files are exported from a SQL database, and each file represents the contents of a table (filtered to include only items that we display publicly in the WGNHS publications catalog)
- publications.json: "Container" items for publications, which may include multiple child resources. Example publication B120 with publication ID 1018 in WGNHS publications catalog
- resources.json: Individual resources associated with publications, such as reports, map plates and datasets. Example report resource B120 in the WGNHS publications catalog (parent publication item is 1018 above)
- contributors.json: Author/resource associations
- citations.json: DOI/resource associations, DOI registration Agency and DOI type (report, journal article, dataset, etc). Not really citations at all!
-
Clone this repository to your local machine
git clone -
Move to the directory on your machine containing this repository
cd doi-registration -
Install NPM dependencies
npm install -
Run the code
npm run build -
2 XML files will be generated in the
output_filesdirectory:journal_dois.xmlandreport_dois.xml -
These files can be submitted to Crossref to register/update DOIs using one of the Direct deposit of XML methods. Existing DOIs in the file will be updated with any metadata changes; new DOIs in the file will be registered.
WGNHS uses HTTPS post, ex:
export CROSSREF_LOGIN_ID=[USERNAME ISSUED BY CROSSREF] && \
export CROSSREF_LOGIN_PASSWORD=[PASSWORD ISSUED BY CROSSREF] && \
curl -F 'operation=doMDUpload' -F "login_id=$CROSSREF_LOGIN_ID" -F "login_passwd=$CROSSREF_LOGIN_PASSWORD" -F 'fname=@report_dois.xml' https://test.crossref.org/servlet/deposit