Download and tested expat

xiaoxiao2021-03-06  74

Start downloading a tar.gz version, after decompression, because my environment is Microsoft Visual C .NET 55601-652-0000007-18068, it is not possible to open. :( It seems to download with CVS, did not say, download WinCVS: http://www.8848software.com/wincvs/wincvs.exe, installation. Set: CVS -D: PServer: anonymous@cvs.libexpat. Org: / cvsroot / expression, the name of Model is also expat, so you can download the latest code of Expat, if you don't do, look at the settings.

After downloading Expat, use VC.NET to open, compile, and smoothly. I compiled the Release_Static version and ready to test. Newly established a project: TestXML, select console, and empty project. Join TestXml.cpp file:

#include "expt.h"

Static void Xmlcall StartElement (Void * UserData, Const Char * Name, Const Char ** Atts)

{

INT I;

INT * DEPTHPTR = (int *) Userdata;

For (i = 0; i <* depthptr; i ) PUTCHAR ('/ t');

* DEPTHPTR = 1; PUTS (NAME);

}

Static void Xmlcall endelement (Void * UserData, Const Char * Name)

{

INT * DEPTHPTR = (int *) Userdata;

* DEPTHPTR - = 1;

}

Int main (int Argc, char * argv [])

{

File * fp;

SIZE_T LEN;

Char BUF [256 * 1024];

INT DONE; INT depth = 0;

XML_PARSER PARSER = XML_Parsercreate (NULL);

XML_SetUserData (Parser, & Depth);

XML_SETELEMENTHANDLER (Parser, StartElement, endelement);

IF (Argc <2) fp = fopen ("Play.xml", "RB");

Else FP = FOPEN (Argv [1], "RB");

IF (! fp) Return 1;

Len = fread (buf, 1, 256 * 1024, fp);

Fclose (fp);

IF (XML_PARSE (Parser, BUF, LEN, DONE) == XML_STATUS_ERROR) RETURN 1;

XML_Parserfree (Parser);

Return 0;

}

Under the path of the LIB path COPY to TESTXML under the EXPAT path, only expat.h, expat_external.h, libexpatmt.lib under the LIB path.

Modify configuration as follows:

Properties page: C / C : General: Additional included directory: ./ LIB

Preprocessor: XML_STATIC

Connector: General: Additional Library: ./lib

In this way, compile can pass :)

转载请注明原文地址:https://www.9cbs.com/read-93610.html

New Post(0)