Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ʹÓÃMsXML¶ÁдXMLÎļþ

// MsXmlTest.cpp : ¶¨Òå¿ØÖÆ̨ӦÓóÌÐòµÄÈë¿Úµã¡£
//
#include "stdafx.h"
#include "MsXmlTest.h"
#include <clocale>
#include "comutil.h"
#import "msxml4.dll"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// ΨһµÄÓ¦ÓóÌÐò¶ÔÏó
CWinApp theApp;
using namespace std;
void WritePerson(MSXML2::IXMLDOMDocument2Ptr pDocument, MSXML2::IXMLDOMNodePtr pParentNode, CString name, long age)
{
//´´½¨Ò»¸ö<Person>½Úµã
MSXML2::IXMLDOMElementPtr pPersonNode = pDocument->createElement(_T("person"));
pParentNode->appendChild(pPersonNode);
//дÈëname
MSXML2::IXMLDOMElementPtr pPersonNameNode = pDocument->createElement(_T("name"));
pPersonNameNode->text = _bstr_t(name);
//дÈëage
MSXML2::IXMLDOMElementPtr pPersonAgeNode = pDocument->createElement(_T("age"));
pPersonAgeNode->text = _bstr_t(age);
pPersonNode->appendChild(pPersonNameNode);
pParentNode->appendChild(pPersonAgeNode);
}
void WritePersons()
{
MSXML2::IXMLDOMDocument2Ptr pXMLDocument;
pXMLDocument.CreateInstance(__uuidof(MSXML2::DOMDocument));
MSXML2::IXMLDOMElementPtr pPersonsNode = pXMLDocument->createElement(_T("persons"));
pXMLDocument->appendChild(pPersonsNode);
WritePerson(pXMLDocument, pPersonsNode, _T("chain"), 25);
WritePerson(pXMLDocument, pPersonsNode, _T("who"), 0);
pXMLDocument->save(_T("persons.xml"));
}
void ReadPersons()
{
MSXML2::IXMLDOMDocument2Ptr pXMLDocument;
pXMLDocument.CreateInstance(__uuidof(MSXML2::DOMDocument));
pXMLDocument->load(_T("persons.xml"));
MSXML2::IXMLDOMElementPtr pRootNode = pXMLDocument->documentElement;
//²éÕÒ<person>½Úµã.
MSXML2::IXMLDOMNodeListPtr pPersonNodes = pRootNode->selectNodes(_T("person"));
CString s;
long size = pPersonNodes->length;
for (int i = 0; i<size; i++)
{
MSXML2::IXMLDOMNodePtr pPersonNode = pPersonNodes->item[i];
MSXML2::IXMLDOMNodePtr pNameNode = pPersonNode->selectSingleNode(_T("name"));
MSXML2::IXMLDOMNodePtr pAgeNode


Ïà¹ØÎĵµ£º

XML ²éѯ¡¢Ìí¼Ó¡¢Ð޸ġ¢É¾³ý

Query:
XmlDocument doc = new XmlDocument();
  
doc.Load(Server.MapPath(".\\db\\dbGuest.xml"));
           
//UserÊÇXML¸ù½Úµã,Name×Ö½Úµã
      lbEmail.Text =
doc.SelectSingleNode("//User ......

wxwidgets ÓÃxmlÀ´ÃèÊö½çÃ棬ÔÚ³ÌÐòÀï»ñÈ¡ ±äÁ¿ºÍʼþ

Èç¹û¶Ô½çÃæÃÀ¹Û³ÌÐò±È½Ï¸ß£¬ÊÖд´úÂëÊDz»¿É±ÜÃâµÄ¡£
µ«Èç¹û×öµÄÊÇһЩÏñÖ»ÊÇΪÁËÏÔʾ¡¢¿ØÖÆÖ®ÀàµÄ³ÌÐò£¬¿ÉÄܸü¿ìµÄ°Ñ³ÌÐòµ·¹Ä³öÀ´¾ÍºÃÁË¡£
wxwidgets
ÓÐÕâÑùµÄÒ»¸ö¹¦ÄÜ£¬¾ÍÊÇÄÜÓÃxmlд³É½çÃæ¾ÍÄÜÏÔʾ
±à¼­xrcµÄ¹¤¾ßÊÇwxformbuilder,¿ªÔ´Ãâ·ÑµÄ£¬Ò²×ã¹»ÓÃÁË£¬ÎÒÒ»¿ªÊ¼Ã»ÕÒµ½Ôõô
Éú³Éxrc,ºóÀ´Ä³´ÎżȻ¿´µ½ÁËÏÂÃæ....Ô­À ......

¹ØÓÚXMLÖÐ×Ö½ÚдÈëÁ÷×Ö¶ÎʱµÄ˵Ã÷

·½·¨Ò»£º
      ²ÉȡͨÓõÄbase64±àÂ뷽ʽ£¬È¡Ê±½âÂë´æʱ¼ÓÂë¡£
ëÀÏʦÌṩÁËÍêÕûµÄ±àÂë´úÂ룬ÇÒЧÂʺܸߡ£
unit Base64;

interface

uses SysUtils, Classes;

type
{$IFDEF UNICODE}
Base64String = AnsiString;
{$ELSE}
Base64String = strin ......

Êý¾Ý¿â²éѯXML½á¹¹£¬FOR XML PATH Óï¾äµÄÓ¦ÓÃ


/*
Êý¾Ý¿â²éѯXML½á¹¹£¬FOR XML PATH Óï¾äµÄÓ¦ÓÃ
*/
FOR XML PATH Óï¾äµÄÓ¦ÓÃ:
CREATE  TABLE TempTable(UserID int , UserName nvarchar(50));
insert into TempTable (UserID,UserName) values (1,'a')
insert into TempTable (UserID,UserName) values (2,'b')
select UserID,UserName from TempTable FOR ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ