bxmlnode: A C++ XML file reader (parser)

D

Daniel Howard

bxmlnode is described as an "XML file reader" (even though it is
technically a parser) to try to avoid confusion with more
sophisticated, standards-compliant XML parsers.

bxmlnode consists of about 500 lines of C source code, none longer
than 80 columns. bxmlnode can be easily pasted into existing C++ or C
source files without linking against a separate library. bxmlnode
relies only on the C Runtime Library, specifically stdio.h, string.h
and stdlib.h, and no other libraries (such as STL).

bxmlnode comes in two versions: bxmlnode.cpp and bxmlnode.c.

bxmlnode.cpp: A free, simple, relatively short, open source basic XML
reader, compatible with almost all C++ compilers. Works with Visual
C++ 6.0, g++ and Turbo C++ 1.0 for DOS (with minor fixes).

http://www.danoneverythingelse.com/bxmlnode.cpp

bxmlnode.c: bxmlnode.cpp with the C++ code deleted and the C
malloc/free code uncommented. Works with Visual C++ 6.0, cc, gcc,
g++, Turbo C 2.0 for DOS and Pacific C 7.51 for DOS.

http://www.danoneverythingelse.com/bxmlnode.c

There is also a Visual C++ 6.0 .dsp project file for both versions.

http://www.danoneverythingelse.com/bxmlnode.zip

bxmlnode is simple. It has one C struct (basicxmlnode) and two
standalone C functions (readbasicxmlnode, deletebasicxmlnode) as its
core API. readbasicxmlnode reads an XML file, creates a tree
representation of the XML file in memory and returns a pointer to the
memory. deletebasicxmlnode deletes the memory.

Three other standalone C functions are included. printbasicxmlnode
shows how to print the tree representation of the XML file in memory
to the console, using recursion. printbasicxmlnodetagnames shows how
to visit every tag in the tree representation of the XML file in
memory, without recursion. main is provided as a demo to show how to
read in a file, print it to the console and then delete its memory.
bxmlnode will compile and run without modifications.

bxmlnode can work with almost any C or C++ compiler, even primitive
DOS compilers.

bxmlnode is free and has an extremely liberal license.

bxmlnode does not support any standards fully. It supports parts of
XML 1.0 specification but not fully (since it throws away processing
instructions). It does not support any DOM specifications (since it
uses its own basicxmlnode struct, not the DOM class hierarchy).
bxmlnode is not a validating XML parser. bxmlnode is not even good
for testing XML to see if it is well-formed (since bxmlnode will read
some files where the XML is not well-formed). bxmlnode is ASCII only.

bxmlnode is for simple XML tasks and not for applications needing
sophisticated XML processing.

There is a short article on bxmlnode at:

http://www.danoneverythingelse.com/articles/Softwarebxmlnode.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top