Usage of libxml2 library in Windows

Source: Internet
Author: User
Tags gz file

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.