GitHub - kriswebdev/BaseXML: Encode binary data within XML or UTF-8 format with minimum overhead (original) (raw)

BaseXML - for XML1.0+

Prupose

BaseXML encodes and decodes BINARY DATA for use WITHIN AN XML 1.0 (or above) document.

It has a constant overhead of 20% (+/- 6 bytes), which is less than Base64's 33% overhead.

The encoded data is Binary-Safe (BS).

BaseXML doesn't include a decoding checksum but you could easily use one if you need it.

Requirements

Your XML 1.0 (or above) document must use the default UTF-8 encoding, i.e.:

    <?xml version="1.0" encoding="UTF-8" ?>

Your XML parser must respect the XML 1.0 norm, i.e. it must support the set of UTF-8 characters defined in the norm and not remove characters like tabs or spaces. Python SAX and EXPAT are compliant.

Implementations

BaseXML implementations are based on C to offer exceptional encoding/decoding speeds.

Implementation name Usage Supported input/output modes Behind-the-scene Technology
BaseXML BS for XML1.0 for C For C scripts or to get an executable FILES C functions
BaseXML BS for XML1.0 for Python For Python scripts PYTHON STRINGS Python module written in C
BaseXML BS for XML1.0 for Javascript For Javascript scripts JAVASCRIPT TYPED ARRAYS.Get it from XMLHttpRequest, Form File or Canvas Image (from converted Blob or FileReader in the latter case). Javascript module written in C, compiled to Javascript through Emsripten with ASM.JS

Installation

Implementation name Install steps Usage steps
BaseXML BS for XML1.0 for C Get the C file. Compile it with GCC (gcc -O3 basexml10.c -o basexml10.exe) or Visual Studio if you want an executable. From the command line: basexml10 -e [] basexml10 -d [] Or from a C file: static int basexml( "e", char *infilename, char *outfilename ); static int basexml( "d", char *infilename, char *outfilename );
BaseXML BS for XML1.0 for Python Get the full source folder and run setup.py install from a command line. You need Visual Studio (tested with 2008) or GCC. From a python *.py file: import basexml str = "hello world" enc = basexml.encode_string(str) dec = basexml.decode_string(enc)
BaseXML BS for XML1.0 for Javascript You just need asmjs.js. You don't need to compile it. From an HTML document:

Author and Licence

BaseXML algorithm and implementations have been developed by KrisWebDev. The applicable license is MIT license or LGPL license depending on implementations (see source files).