Mini-XML is an excellent API to generate and parse XML. Its web site is:
http://www.msweet.org/projects.php?Z3. It was writtenin C language. Although there is a Visual Studioproject file in the "vcnet" subdirectory of Mini-XML 2.10 to build the library,the projectis a bit old and not suitable for varIoUs Visual Studio versions.Command prompt is an alternative choice tobuild the library on Windows platform. The static library of Mini-XML on Windows is NOT thread-safe. So only dynamic library is considered here. The following commands can be used to build Mini-XML 2.10 DLL (Don't start immediately. Don'tforget toread the notes below the commands):
------------------------------------------------------
1. build 32-bit debug version DLL:
------------------------------------------------------
1. build 32-bit debug version DLL:
vcvarsall x86 cl /c /D "WIN32" /Gd /MDd /nologo /Zi mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c link /DEF:mxml1.def /DLL /DEBUG /IMPLIB:mxml_x86d.lib /MACHINE:X86 /NOlogo /OUT:mxml_x86d.dll /PDB:mxml_x86d.pdb /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x86d.dll and mxml_x86d.lib are built.
------------------------------------------------------
2. build 32-bit release version DLL:
------------------------------------------------------
2. build 32-bit release version DLL:
vcvarsall x86 cl /c /D "WIN32" /Gd /MD /nologo mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c link /DEF:mxml1.def /DLL /IMPLIB:mxml_x86.lib /MACHINE:X86 /NOlogo /OUT:mxml_x86.dll /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x86.dll and mxml_x86.lib are built.
------------------------------------------------------
3. build 64-bit debug version DLL:
------------------------------------------------------
3. build 64-bit debug version DLL:
vcvarsall x64 cl /c /D "WIN32" /Gd /MDd /nologo /Zi mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c link /DEF:mxml1.def /DLL /DEBUG /IMPLIB:mxml_x64d.lib /MACHINE:X64 /NOlogo /OUT:mxml_x64d.dll /PDB:mxml_x64d.pdb /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x64d.dll and mxml_x64d.lib are built. Here in the command /D "WIN32" must be used. You cannot use /D "WIN64".The reason is : the following macro is defined in "mxml-file.c":
------------------------------------------------------
4. build 64-bit release version DLL:
#ifndef WIN32 # include <unistd.h> #endif /* !WIN32 */ #include "mxml-private.h"If /D "WIN64" is used,the header file "mxml-private.h" will not be included. The compiler cannot find "unistd.h" on Windows platform. It wiil report an error.
------------------------------------------------------
4. build 64-bit release version DLL:
vcvarsall x64 cl /c /D "WIN32" /Gd /MD /nologo mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c link /DEF:mxml1.def /DLL /IMPLIB:mxml_x64.lib /MACHINE:X64 /NOlogo /OUT:mxml_x64.dll /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x64.dll and mxml_x64.lib are built. Here in the command /D "WIN32" must be used. You cannot use /D "WIN64".The reason is the same as stated above.
------------------------------------------------------
Note:
1. "vcvarsall" is a .BAT file included in all versions of Visual Studio. In VS 2010,it is in the folder "\Microsoft Visual Studio 10.0\VC\ ".
2. "config.h" and "mxml1.def" are in the "vcnet" subdirectory. Users need to copy the two file to the folder including C source code files of mini-XML. "mxml1.def" must be modified as follows:
------------------------------------------------------
Note:
1. "vcvarsall" is a .BAT file included in all versions of Visual Studio. In VS 2010,it is in the folder "\Microsoft Visual Studio 10.0\VC\ ".
2. "config.h" and "mxml1.def" are in the "vcnet" subdirectory. Users need to copy the two file to the folder including C source code files of mini-XML. "mxml1.def" must be modified as follows:
delete the first line: LIBRARY "mxml1"
Now the content of the"mxml1.def" should be:
EXPORTS _mxml_strdupf _mxml_vstrdupf mxml_ignore_cb mxml_integer_cb mxml_opaque_cb mxml_real_cb mxmlAdd mxmlDelete mxmlElementDeleteAttr mxmlElementGetAttr mxmlElementSetAttr mxmlElementSetAttrf mxmlEntityAddCallback mxmlEntityGetName mxmlEntityGetValue mxmlEntityRemoveCallback mxmlFindElement mxmlFindPath mxmlGetCDATA mxmlGetCustom mxmlGetElement mxmlGetFirstChild mxmlGetInteger mxmlGetLastChild mxmlGetNextSibling mxmlGetOpaque mxmlGetParent mxmlGetPrevSibling mxmlGetReal mxmlGetRefCount mxmlGetText mxmlGetType mxmlGetUserData mxmlIndexDelete mxmlIndexEnum mxmlIndexFind mxmlIndexGetCount mxmlIndexNew mxmlIndexReset mxmlLoadFd mxmlLoadFile mxmlLoadString mxmlNewCDATA mxmlNewCustom mxmlNewElement mxmlNewInteger mxmlNewOpaque mxmlNewReal mxmlNewText mxmlNewTextf mxmlNewXML mxmlRelease mxmlRemove mxmlRetain mxmlSaveAllocString mxmlSaveFd mxmlSaveFile mxmlSaveString mxmlSAXLoadFd mxmlSAXLoadFile mxmlSAXLoadString mxmlSetCDATA mxmlSetCustom mxmlSetCustomHandlers mxmlSetElement mxmlSetErrorCallback mxmlSetInteger mxmlSetOpaque mxmlSetReal mxmlSetText mxmlSetTextf mxmlSetUserData mxmlSetWrapMargin mxmlWalkNext mxmlWalkPrev3. "_x86" suffix is added to the names of 32-bit LIB and DLL files,and "_x64" suffix is added to the names of the 64-bit LIB and DLL files.
4. "d" suffix is added to the names of the debug version LIB and DLL files.
5. The command prompt method can show details hidden by VS .SLN file or VS IDE. It does not need to be changed as VISUAL STUdio version evolves. Users can choose other parameters for compiling or linking on demand.