zotero / translation-server

A Node.js-based server to run Zotero translators
Other
121 stars 50 forks source link

TEI export produces invalid XML #85

Closed dstillman closed 5 years ago

dstillman commented 5 years ago

A TEI document uses a dedicated XML namespace but includes an id attribute in the XML namespace. The JSDOM XMLSerializer we're using is exporting the id with an ns1 prefix, which makes it invalid XML. The XMLNS prefix has to be xml, and it doesn't need to be defined, so there should just be an xml:id="…" attribute. It's possible the TEI translator could do something different here, but this works properly in Firefox, so I assume this is a bug in JSDOM XMLSerializer.

Reproduce with npm test -- -g TEI

The parser error is may not assign the xml namespace to another prefix.

Reported here: https://groups.google.com/d/topic/zotero-dev/GGpHfZlO8FM/discussion

mvolz commented 5 years ago

I'm getting this test failing:

/export should export to TEI:

  AssertionError: expected 'parsererror' to equal 'listBibl'
  + expected - actual

  -parsererror
  +listBibl

  at Context.<anonymous> (test/export_test.js:145:10)
  at process.internalTickCallback (internal/process/next_tick.js:77:7)

Is this the same bug?

mvolz commented 5 years ago

Ah yes, answered my own question: 7bce4a3e2cc6fd3eb50d459d59fdf7e7e524b049

dstillman commented 5 years ago

Are you running with the latest version and current packages? This was fixed in #86 the same day this ticket was opened back in February.