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

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

Post by dan » Wed, 28 Jul 2004 23:38:31

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


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.


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


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:


1. Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser)

2. An XML parser is an XML parser. Period.

XML is clear on what a Parser *must* support. The full character
production is one of those things. From XML 1.0, section 2.2:

Character Range
[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |

There is no "option" to not support characters greater than #xFF. XML
parsers *can* leave off handling some aspects of XML, external DTD
subsets, for example, but you can not be as fundamentally
non-conformant as PyRXP and still call yourself an XML parser.

This is not just an academic matter. There are a *vast* number of
useful and heavily-used characters of code point higher than U+FF and
if parsers decided on a whim to pick and choose what to support the
result would be complete and utter chaos.

PyRXP is not an XML parser. It's that simple. I stand by that veru
strong satement, and I'd be surprised if XML expert refusaes to
corroborate it.

I do want to point out that PyRXPU does seem to be a proper XML
parser, and is what people should use instead if they like the
ReportLab products.

Of course if yu don't really need an XML parser, feel free to use
PyRXP. Just don't call it what it isn't.


3. XML::Parser Installation error: XML-Parser-2.34

4. XML-Parser to XML-Parser communication (encoding issues?)

5. XML parser as reader macro?

6. which XML parser will be efficient for reading XML file?

7. Can I read String (XML content) rather XML file using SAX parser

8. Register my XML Parser to a XML File

9. Big Xml file hangs - Bug in Xml Parser?????

10. open source xml parser in C++

11. Any efficient XML parser for C++?

12. Simple and good XML parser for C++?

13. xml parser engine for c++

14. XML Parser, XML/XSD validation, XML Generation Functionality in VB.net

15. C++ to XML parser - does one exist?