NatLibFi / sru-client-js

SRU Javascript client library
MIT License
7 stars 5 forks source link

Make parsing namespace prefix agnostic #25

Open natlibfi-arlehiko opened 4 years ago

natlibfi-arlehiko commented 4 years ago

Currently the implementation supports only namespace prefix zs. Make the parsing understand any prefix.

cboulanger commented 3 years ago

Some servers (such as https://services.dnb.de/sru/dnb) return XML without the ZS namespace. This breaks the library:

TypeError: Cannot read property 'zs:numberOfRecords' of undefined
    at parsePayload /path/to/node_modules/.pnpm/@natlibfi+sru-client@4.1.0/node_modules/@natlibfi/sru-client/dist/index.js:170:83)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async processRequest (/path/to/node_modules/.pnpm/@natlibfi+sru-client@4.1.0/node_modules/@natlibfi/sru-client/dist/index.js:118:15)
    at async iterate (/path/to/node_modules/.pnpm/@natlibfi+sru-client@4.1.0/node_modules/@natlibfi/sru-client/dist/index.js:93:9)