Skip to content

JavaScript Implementation of EXI and EXI for JSON

Notifications You must be signed in to change notification settings

cancom/exificient.js

 
 

Repository files navigation

exificient.js

JavaScript Implementation of EXI and EXI for JSON

Build Status

How to get

NPM

https://www.npmjs.com/package/exificient.js

npm install exificient.js

unpkg, CDN (content delivery network)

https://unpkg.com/exificient.js@0.0.5/dist/exificient.js

Demo

An online demonstration can be found here: http://exificient.github.io/javascript/demo/.

How to use

HowTo for EXIforJSON

// encode JSON object
var uint8Array = EXI4JSON.exify(jsonObjIn);

// decode EXIforJSON
var jsonObjOut = EXI4JSON.parse(uint8Array);

HowTo for EXI

// Note: the necessary grammars can be generated from XML schema using
// the project https://github.com/EXIficient/exificient-grammars
// class com.siemens.ct.exi.grammars.persistency.Grammars2JSON 

// encode XML
var exiEncoder = new EXIEncoder(grammars);	
exiEncoder.encodeXmlText(textXML);
var uint8ArrayLength = exiEncoder.getUint8ArrayLength();
var uint8Array = exiEncoder.getUint8Array();

// decode EXI to XML again
var exiDecoder = new EXIDecoder(grammars);
var xmlHandler = new XMLEventHandler(); // register XML handler
exiDecoder.registerEventHandler(xmlHandler);
exiDecoder.decode(arrayBuffer); // EXI input data
xmlHandler.getXML(); // get XML

About

JavaScript Implementation of EXI and EXI for JSON

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 65.0%
  • Java 28.0%
  • HTML 6.0%
  • JavaScript 1.0%