(1) -- Build the environment, download and install libxml2 and iconv
Libxml2 is a C-language XML library that provides easy and convenient operations on XML documents, and supports XPath query and some XSLT conversion functions. Libxml2 is http://xmlsoft.org/downloads.html. the full version of the library is open source, along with examples and instructions. The full version is named libxml2-2.7.8.tar.gz.
The default inner code in libxml2 is the UTF-8, and all XML files that use libxml2 for processing must be explicitly or by default converted to UTF-8 encoding before being processed.
To use Chinese in XML, you must be able to convert between the UTF-8 and the gb2312 internal code (a more commonly used simplified Chinese code. Libxml2 provides the default internal code conversion mechanism, and has an example in the tutorial of libxml2. It turns out that this example is not suitable for Chinese conversion. Therefore, we need to explicitly use iconv for internal code conversion. libxml2 itself is also used for iconv conversion. Iconv is a library dedicated for encoding and conversion. It basically supports all common encodings. It is a part of the glibc library and is often used in UNIX systems. Of course, there is no problem in using Windows.
The parameter is.
Decompress libiconv-1.9.2-1-lib.zip and extract the iconv. H put it in the C: \ opt \ include directory, and put the libiconv. place Lib in c: \ opt \ Lib and change it to iconv. lib. (create one without the OPT directory ).
Decompress libxml2-2.7.8.tar.gz file to C drive root directory, in c: \ libxml2-2.7.8 \ libxml2-2.7.8 \ Win32 Directory contains multiple Windows platform compiler MAKEFILE file, we use vs2008, so will be used makefile. msvc file.
1. Go to Visual Studio 2008 command prompt;
2. cd c: \ libxml2-2.7.8 \ libxml2-2.7.8 \ Win32
3. Enter cscript Configure. js compiler = msvc prefix = c: \ opt include = c: \ opt \ include Lib = c: \ opt \ Lib DEBUG = Yes, and press enter to execute.
4. Run the nmake command to compile the program. Input nmake/F makefile. msvc and press Enter.
An error message is displayed,
Makefile. msvc (465): Fatal error u1020: End-of-file found before next directive
Stop.
I found the cause on the Internet. It turns out that there is an error in makefile. msvc.
+! If "$ (with_icu)" = "1" + libs = $ (libs) ICU. Lib +! Endif
Delete the plus signs in front of the preceding three rows and re-Execute nmake.
A bin. msvc directory is generated in the current Win32 Directory, which contains the libxml2.lib and libxml2.dll files required for development.