If you use Microsoft XML to parse the dynamic Connection Library (msxml4.dll) |
Cpro_client = 'scorpioylj _ CPR '; cpro_at = 'text'; cpro_161 = 4; cpro_flush = 2; cpro_uap = 1; cpro_w = 960; cpro_h = 90; cpro_template = 'text _ default_960_90 '; cpro_cbd =' # trans '; cpro_cbg =' # trans '; cpro_ctitle =' # 0066cc '; cpro_cdesc =' #444444 '; cpro_curl = '#008000'; cpro_cflush = '# e10900 '; |
Cpro_client = 'scorpioylj _ CPR '; cpro_at = 'text'; cpro_161 = 4; cpro_flush = 2; cpro_w = 760; cpro_h = 90; cpro_template = 'text _ rect '; cpro_cbd = '# ffff'; cpro_cbg =' # ffffff'; cpro_ctitle = '# 0066cc'; cpro_cdesc = '#444444'; cpro_curl = '#008000 '; cpro_cflush = '# e10900'; cpro_uap = 1; cpro_cad = 1;
The last post describes how to learn how to access databases through ADO and ODBC.
Next post: Compile boost1. for Windows XP/vc6.0 online shopping, online shopping, shopping search
Welcome to this site to purchase books, movies, music, digital, department stores, mobile phones and other products. Use XML parsing (msxml4.dll)
C ++ Code The following code is excerpted from the csdn Forum.
# Include "stdafx. H"
# Include <windows. h>
# Include <msxml2.h>
# Import <msxml4.dll>
Handle logfile = NULL;
# Define indent 4
# Define testhr (HR )\
{\
If (failed (HR) goto fail ;\
}
Void printchild (ixmldomnodelist * nodelist, int level)
{
If (nodelist = NULL)
Return;
Ixmldomnode * currentnode = NULL;
Ixmldomnodelist * childnodes = NULL;
Ixmldomnamednodemap * attributes = NULL;
Ixmldomnode * attributeid = NULL;
While (! Failed (nodelist-> nextnode (& currentnode) & currentnode! = NULL)
{
BSTR nodename;
Testhr (currentnode-> get_nodename (& nodename ));
DWORD dwbyteswritten;
For (INT I = 0; I <level * indent; I ++)
Writefile (logfile, l "", (DWORD) (sizeof (wchar), & dwbyteswritten, null );
// Wchar MSG [max_size];
// Wsprintf (MSG, l "% s", nodename );
Writefile (logfile, nodename, (DWORD) (wcslen (nodename) * sizeof (wchar), & dwbyteswritten, null );
Testhr (currentnode-> get_attributes (& attributes ));
If (attributes! = NULL)
{
_ Bstr_t bstrattributename = "ID ";
BSTR idval;
Testhr (attributes-> getnameditem (bstrattributename, & attributeid ));
If (attributeid! = NULL)
{
Testhr (attributeid-> get_text (& idval ));
Writefile (logfile, l "", (DWORD) (sizeof (wchar), & dwbyteswritten, null );
Writefile (logfile, idval, (DWORD) (wcslen (idval) * sizeof (wchar), & dwbyteswritten, null );
Writefile (logfile, l "\ r \ n", (DWORD) (2 * sizeof (wchar), & dwbyteswritten, null );
Attributeid-> release (); attributeid = NULL;
}
Else
{
Writefile (logfile, l "\ r \ n", (DWORD) (2 * sizeof (wchar), & dwbyteswritten, null );
}
Attributes-> release (); Attributes = NULL;
}
Else
{
Writefile (logfile, l "\ r \ n", (DWORD) (2 * sizeof (wchar), & dwbyteswritten, null );
}
Testhr (currentnode-> get_childnodes (& childnodes ));
Printchild (childnodes, level + 1 );
Currentnode = NULL;
}
Fail:
If (childnodes! = NULL)
Childnodes-> release ();
If (attributeid! = NULL)
Attributeid-> release ();
If (attributes! = NULL)
Attributes-> release ();
If (currentnode! = NULL)
Currentnode-> release ();
}
Int _ tmain (INT argc, _ tchar * argv [])
{
Ixmldomdocumentptr xmlfile = NULL;
Ixmldomelement * xmlroot = NULL;
_ Variant_t varxml (L "C :\\ demo1.xml ");
Logfile = createfile (L "log.txt", generic_write, 0, null, create_always, file_attribute_normal, null );
If (logfile = invalid_handle_value)
Goto fail;
Testhr (coinitialize (null ));
Testhr (xmlfile. createinstance ("msxml2.domdocument. 4.0 "));
Variant_bool varout;
Testhr (xmlfile-> load (varxml, & varout ));
Testhr (xmlfile-> get_documentelement (& xmlroot ));
BSTR rootname;
DWORD dwbyteswritten;
Testhr (xmlroot-> get_nodename (& rootname ));
Writefile (logfile, rootname, (DWORD) (wcslen (rootname) * sizeof (wchar), & dwbyteswritten, null );
Writefile (logfile, l "\ r \ n", (DWORD) (2 * sizeof (wchar), & dwbyteswritten, null );
Ixmldomnodelist * xmlchildnodes = NULL;
Testhr (xmlroot-> get_childnodes (& xmlchildnodes ));
Printchild (xmlchildnodes, 2 );
Fail:
If (logfile! = Invalid_handle_value)
Closehandle (logfile );
If (xmlchildnodes! = NULL)
Xmlchildnodes-> release ();
If (xmlroot! = NULL)
Xmlroot-> release ();
Return 0;
}
The installation and deployment will use Program To add the merging module msxm4sys32. MSM to the installation and deployment project, follow these steps.
Add installation and deployment projects
To package the current project as an installer, you can use the installer provided by. net. In the current project, open the menu "add Project". The "add project" dialog box appears.
Box, select "installation and deployment Project" in "project type", select "Installation Project" in "template", and enter "name" and "directory ", in Solution Explorer, A installation and deployment project is generated. Right
Click the installation project and select "View" à "File System" in the pop-up menu. In the file system, you can add any files that you want to include in the installation program.
Install msxm4sys32. MSM. skip this step if the msxm4sys32. MSM file already exists in c: \ Program Files \ common files \ merge modules.
Download and install msxml4msms.exe. msxml4msms.exe can be downloaded from the following address, which contains msxml4sxs32. MSM and msxm4sys32. MSM.
Http://download.microsoft.com/download/9/6/5/9657c01e-107f-409c-baac-7d249561629c/msxml4msms.exe
Add merging module right-click the installation project, select "add" à "merging module" in the pop-up menu, and select "msxm4sys32. MSM" in the select file dialog box ".
References
Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/dnnetdep/html/dotnetframedepguid. asp? Frame = true