Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.46 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.46 KB

sdmxmllib

Build Status current version License

Experimental Javascript client library for mapping SDMX-ML 2.1 structure messages.

This library contains functions for mapping SDMX-ML 2.1 structure messages to Javascript objects. Library is used for prototyping the SDMX-JSON Structure message and supports a limited number of structures (with more to come):

  • Codelist
  • Concept Scheme
  • Agency Scheme
  • Dataflow
  • Category Scheme
  • Categorisation
  • Hierarchical Codelist (partial: no levels)

See the XML mapping sample for a live demo.

Usage

Either include the library on a web page or require in Node.js.

Mapping

mapSDMXMLResponse

Maps SDMX-ML Structure message into Javascript objects. Accepts a SDMX-ML 2.1 Structure Message as input.

// req is a XMLHttpRequest object
var msg = sdmxmllib.mapSDMXMLResponse(req.responseText);

console.log(msg.header.id);                 // "IDREF99224"
console.log(msg.resources.length);          // 10
console.log(msg.resources[0].id);           // "CL_ADJUSTMENT"
console.log(msg.resources[0].name);         // "Adjustment indicator code list"
console.log(msg.resources[0].items[0].id);  // "C"