ÈçºÎÔÚVC»·¾³Ï±àд³ÌÐò¶ÁÈ¡XMLÎļþ
ÈçºÎÔÚVC»·¾³Ï±àд³ÌÐò¶ÁÈ¡XMLÎļþ?ÇåÌṩԴ´úÂë.лл.
#import <msxml3.dll> named_guids //µ¼È붯̬¿â£¬×°ÁËIE5¾ÍÓÐ
using namespace MSXML2; //ÒýÓÃÃüÃû¿Õ¼ä£¬Ò»°ã¿ÉÒÔ°ÑÃüÃû¿Õ¼äÀí½â³ÉÀàºÍ½Ó¿ÚµÄ¼¯ºÏ£¬ºÇºÇ£¬¶Ô²»¶ÔÎÒÒ²²»ÖªµÀÁË
#include <vector>
using namespace std;
struct FIELD
{
public:
CString name;
CString type;
CString length;
CString explain;
CString allowNull;
CString autoIncrease;
};
class Xml
{
public:
Xml(void);
~Xml(void);
private:
HRESULT hr;
MSXML2::IXMLDOMDocumentPtr pDoc; //XMLÎĵµ½Ó¿ÚÖ¸Õë
public:
void AddKey(CString moduleName,CString keyName, CString keyValue);
CString ReadKeyValue(CString moduleName, CString keyName);
private:
void NewDocument(CString moduleName, CString keyName, CString keyValue);
public:
bool ReadTable(CTreeCtrl * tree);
bool ReadFields(CString tableName,vector<FIELD> &fields);
bool SaveTable(vector<FIELD> fields,CString tableName,bool bNew);
};
//-------------------------------------------------------------------------------------------------------------------------------------
ÉÏÃæÊÇÍ·Îļþ£¬ÕâÊÇcppÎļþ
#include "StdAfx.h"
#include "xml.h"
Xml::Xml(void)
{
CoInitialize(NULL); //³õʼ»¯COM
hr=CoCreateInstance(MSXML2::CLSID_DOMDocument,NULL,CLSCTX_ALL,MSXML2::IID_IXMLDOMDocument,(void**)&pDoc); //´´½¨XMLÎĵµÊµÀý
}
Xml::~Xml(void)
{
CoUninitialize();
}
void Xml::AddKey(CString moduleName,CString keyName, CString keyValue)
{
CString selectString="AppSetting/"+moduleName; //XML½Úµã¶¨Î»×Ö·û´®£¬¶¨Î»µ½½ÚµãÃûΪ
Ïà¹ØÎĵµ£º
¼òµ¥µØËµ£¬xslÊÇ˵Ã÷xmlÈçºÎ±í´ï³öÀ´µÄÑùʽÎļþ£¬¶øxsd¸ø³öxmlÎļþµÄ¸ñʽÃèÊö
Èç¹û˵xmlÊÇÒ»µþ³®Æ±£¬xsd¾ÍÊÇÑé³®»ú£¬¿´¿´ÀïÃæÓÐûÓмٳ®£¬¶øxslÊǵ㳮»ú£¬¿´¿´µ½µ×ÊǶàÉÙÇ®¡£ÓÃxml¿ÉÒÔ²»ÓÃxsd£¬¾ÍÏñ»¨Ç®µÄʱºò²»Ò»¶¨ÒªÑé³®Ò»Ñù£¬µ«ÊÇÊÕÇ®µÄÈËÒ»°ãÊÇÏëÒªÑéµÄ¡£¶ø»¨Ç®µÄʱºò²»Äܲ»µã³®£¬²»µãÄǾͲ»ÊÇ»¨Ç®ÁË£¬ÊÇÍæÇ®¡£µ±È»ÁË£ ......
µ±ÊäÈë ¡·Ê±×Ô¶¯²¹È« µ±ÊäÈë¡¶/ʱ×Ô¶¯²¹È«
“£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½£½
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
XPath Óï·¨
2007-06-05 17:24
XPath Óï·¨
×÷Õß:w3pop.com ·Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ä¯ÀÀ:674 :: ::
XPath Nodes(½Úµã) XPath Axes
XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.
XPath ͨ¹ý·¾¶±í´ïʽ´ÓXM ......
PerlµÄXML::DOM¹¦ÄܺÜÇ¿´ó£¬ÀûÓÃËü¿ÉÒÔÇáÒ׵طÖÎöXMLÎĵµ£¬Ò²¿ÉÒÔ½¨Á¢XMLÎĵµ¡£
³£ÓõÄÀà°üÀ¨£º
XML::DOM::Node£ºËùÓÐÀàµÄ»ùÀ࣬±íʾһ¸öXML½Úµã¡£
XML::DOM::Parser£ºXML½âÎöÆ÷£¬½«XML×Ö·û´®½âÎö³ÉXML::DOM::Document¶ÔÏó¡£
XML::DOM::Document£ºÖ¸ÏòXMLÎĵµµÄ¸ù½Úµã¡£
XML::DOM::Element£ºÖ¸ÏòÒ»¸öÔªËØ£¬Í¨³£ÓÉXML:: ......
´´½¨XMLÎļþ£º
public boolean createXML(){
try{
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement("root");
Element personNode = root.addElement("person");
Element sonNode = personNode ......