/XS-XML

An extra-small, single-file, portable XML parser and compiler library, written in C as well as in JavaScript.

Primary LanguageCApache License 2.0Apache-2.0

XS-XML : An extra-small XML parser and compiler.


Description

XS-XML is a tiny, basic, single-file, and portable XML parser and compiler.

||--- A NEW feature has been added in XS-XML version 1.2 ---||

||--- XS-XML is now a file extension, too (*.xsmxl). ---||

||--- XS-XML can now compile and utilise it's very own XML processed binary files. ---||

XS-XML stands for 'Extra small XML'. It works fine with simple XML files written as per the standards of version 1.0 and encoding of UTF-8.

Though it can parse CDATA and character entity references (CERs), it does not cater to the following features:

  • XML schemas and DTDs
  • Name prefixes
  • XML namespaces (the xmlns attribute)


For a quick illustration of the library’s functions (their input names and types, and their output types), and their structures, enumerations and variables, refer to the xsxml.h file.


To read more about the XS-XML library, refer to its Documentation Manual.


Features

  • XML file parser and compiler
  • Single-file and portable library
  • Extracts information in a meaningful manner
  • Extracts information in the form of inter-connected nodes
  • Perform a basic validation check and returns the result
  • Apt for basic, everyday, and non-sophisticated use
  • Can search through the extracted data based on given input
  • Works with unicode characters (UTF-8)
  • Works with CDATA and character entry references (CER)
  • Works with both empty (<tag/>) and non-empty (<tag>some data</tag>) tags
  • Works in RAM mode using arrays, pointers and objects
  • Works in FILE mode for large XML data files
  • The FILE mode relies on the computer file system
  • The FILE mode utilises negligible RAM space
  • Written in two programming languages: C and JavaScript (JS)
  • NEW FEATURE ADDED:
    Create processed XS-XML binary object files that act as memory resident databases (Linux and POSIX only).
    The created XS-XML binary object file would be smaller in file size than its original XML file (between one-third and two-thirds). The *.xsxml files upload and compile data a lot quicker, given their off-the-shelf format.


NOTE: The FILE mode only works in C, and not in JavaScript (JS), for obvious reasons.


This is the description image.


Files list

The following are a list of files present within the XS-XML library's GitHub repository.

Sr. No. File name File Description
1. xsxml.c The XS-XML C source code file
2. xsxml.h The XS-XML C header file
3. xsxml.js The XS-XML JavaScript source code file
4. xsxml_binary_object.c [NEW] The XS-XML binary object C source code file
5. xsxml_binary_object.h [NEW] The XS-XML binary object C header file
6. test_1.c The RAM mode XML parse example test file in C
7. test_2.c The FILE mode XML parse example test file in C
8. test_3.c The RAM mode XML compile example test file in C
9. test_4.html The XML parse example test file in JavaScript
10. test_5.html The XML compile example test file in JavaScript
11. test_6.c [NEW] Create a processed XML binary object file
12. test_7.c [NEW] Test the processed XML binary object file
13. test_data.xml The example test XML data file
14. Documentation_Manual.pdf The Documentation Manual PDF file


Motivation

I created this library as a necessity for my other projects. I could not find any viable, single-file, basic XML-parser (one that not just extracts the tag elements, but also connects them in a meaningful way), and so, I decided to create one myself. While utilising this library for my projects, and thereby testing it, I came across a few minor run-time errors (mostly related to segmentation faults due to faulty array memory allocations), which I had then immediately corrected.


Hope you find this library useful.