Skip to content

kriswebdev/BaseXML

Repository files navigation

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 nameUsageSupported input/output modesBehind-the-scene Technology
BaseXML BS for XML1.0 for CFor C scripts or to get an executableFILESC functions
BaseXML BS for XML1.0 for PythonFor Python scriptsPYTHON STRINGSPython module written in C
BaseXML BS for XML1.0 for JavascriptFor Javascript scriptsJAVASCRIPT 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 nameInstall stepsUsage 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 <FileIn> [<FileOut>]
basexml10 -d <FileIn> [<FileOut>]
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:
<script src='asmjs.js'></script>
<script>
source = ...; // Needs to be a UInt8array, see .html file for examples
encoded = BaseXML.encode( source );
decoded = BaseXML.decode( encoded );
</script>

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).

About

Encode binary data within XML or UTF-8 format with minimum overhead

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published