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

TinyXML(C++ XML½âÎö¿â)

дһ¸öXMLÎļþ TinyXML ÊÇÒ»¸öminiµÄC++ XML½âÎö¿â,ËüÊÇ·ÇÑéÖ¤µÄ,Ëü¿ÉÒÔºÜÈÝÒ׵ļ¯³Éµ½ÆäËûµÄ³ÌÐòÖÐ.Ëü½âÎöÒ»·ÝXML doc,ÒÔ´Ë´´½¨Ò»¸ö¿ÉÒÔ±»¶Á¡¢Ð´£¬±£´æµÄDOM.ËüÖ÷ÒªµÄÀà²ã´Î¼Ü¹¹£¬º¯ÊýÔ­ÐÎÏêϸ˵Ã÷²Î¿´: http://www.grinninglizard.com/tinyxml/index.html
// ÒÔÏÂÒÔ¼òµ¥µÄ³ÌÐòTinyXMLTestΪÀý TinyXMLÖÐ×î¸ù±¾µÄ¾ÍÊÇDocument£¬ËùÒÔÎÞÂÛÊÇÐèҪдһ¸öXMLÎļþ£¬»¹ÊÇÒª¶Á£¬¶¼±ØÐë´ÓÒ»¸öDocument¿ªÊ¼,¾ÍÊÇ(1)µÄ¶¯×÷,ÔÚ´ËûÓиø¹¹Ô캯ÊýÒ»¸ö²ÎÊýÊÇÒòΪÎÒÃǵÄÄ¿µÄÊÇΪÁËд³öÒ»¸öXMLÎļþ£¬ÎļþµÄÃû×Ö¾ÍÊÇ´«¸øTiXmlDocumentµÄ²ÎÊý¡£ÉùÃ÷£¬Îĵµ£¬×¢ÊÍ£¬Îı¾,ÔªËØ£¬²»Ã÷ÀàÐͶ¼ÊÇTinyXmlNodeµÄ×ÓÀ࣬¶¼ÊÇÒ»¸öNode,TinyXmlNodeÊÇÒ»¸öºÜ¸´ÔӵĶ«Î÷£¬ËüÈçÉÏËùʾ:
#include
#include "tinyxml.h"
using namespace std;
int main(int argc, char** argv)
{
// (1) create a XML document
TiXmlDocument *myDoc = new TiXmlDocument();
DocumentÀàÐ͵Ľڵ㽨Á¢ºÃÒԺ󣬾ÍÐèÒª¸ø¸Ã£Ä£Ï£ÍÊ÷½á¹¹Ò»¸ö¸ù,¼´ÏÂÃæµÄ(2),(3),(5),ÓÉÓÚTinyXmlÊÇ·ÇÑéÖ¤µÄ£¬ËùÒÔÀíÂÛÉÏËûÊÇ¿ÉÒÔÓÐÁ½¸öDocumentµÄ£¬£¨ÔÚÄÚ²¿Í¨¹ý¶ÔÀàÐ͵ÄÅжÏÀ´±ÜÃâÕâÒ»Çé¿öµÄ·¢Éú£©,ÓÉÓÚ¸ùÊÇÒ»¸öÔªËØ£¬¶øÔªËر¾ÖÊÉϾÍÊÇÒ»¸öÈÝÆ÷£¬Ëû¿ÉÒÔÓÐ×ÓÔªËØ£¬Îı¾µÈ£¬ÓÉÓÚÊôÐÔ¿ÉÒÔÓжà¸ö£¬ËùÒÔÔÚÄÚ²¿ËüÓÐÒ»¸öTinyXmlAttrbuiteSetµÄ³ÉÔ±£¬ÓÃÒÔ´¢´æÖ®£¬¶øÔÚTinyXmlAttrbuiteSetÖÐËù´æµÄAttrbuitesÊÇͨ¹ý´ø”ÉÚ±ø”µÄÁ´±íÀ´ÊµÏÖ.ÔÚÿ´ÎÁ´½Óʱ£¬¶¼ÊÇ·ÅÖÃÔÚ×îºóÒ»¸öλÖÃ
//(2) create the Root and connect it
TiXmlElement *RootElement = new TiXmlElement("ÈËÔ±×é");
myDoc->LinkEndChild(RootElement);
//(3 )create a person and connect it
TiXmlElement *PersonElement = new TiXmlElement("ÈËÔ±");
RootElement ->LinkEndChild(PersonElement);
Èç(4)Ëùʾ£¬Èç¹ûÒ»¸öÔªËØÓÐÊôÐÔÐèÒªÉèÖã¬Í¨¹ýµ÷ÓÃSetAttribute()·½·¨,¿ÉÒÔʵÏÖÄ¿±ê,ÔÚÉèÖÃʱ£¬»áÔÚElementµÄÄÚ²¿µÄÁ´±íÉÏËÑË÷£¬Èç¹ûÒѾ­ÓÐÏàÓ¦µÄÊôÐÔÃû£¬ÄÇôÊÓ֮Ϊ¸Äд,Èç¹ûûÓÐÔòÌí¼Ó.
//(4) set the attribute fo Person
PersonElement ->SetAttribute("ID", "1");
//(5) create Elementy name && age and connect them
TiXmlElement* NameElement = new TiXmlElement("ÐÕÃû");
TiXmlElement* AgeElement = new TiXmlElement("ÄêÁä");
PersonElement ->LinkEndChild(NameElement);
PersonElement ->


Ïà¹ØÎĵµ£º

XMLÈëÃŵij£¼ûÎÊÌâ(Èý)

ÈçºÎ¼ÓÔØÓÐÍâ¹úºÍÌØÊâ×Ö·ûµÄÎĵµ£¿
¡¡¡¡Îĵµ¿ÉÒÔ°üº¬Íâ¹ú×Ö·û£¬ÀýÈ磺
 ¡¡¡¡foreign characters (úóí?) 
¡¡¡¡ÀýÈç íá µÄÍâ¹ú×Ö·û±ØÐëÔÚÇ°Ãæ¼ÓÉÏ escape ÐòÁС£Íâ¹ú×Ö·û¿ÉÒÔÊÇ UTF-8 ±àÂë»òÓò»Í¬±àÂëÖ¸¶¨£¬ÈçÏÂËùʾ£º
 ¡¡¡¡foreign characters (íá) 
¡¡¡ ......

XML½âÎö·½·¨½²½â

XMLÏÖÔÚÒѾ­³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝÓÐDOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Exten ......

c++Öе÷ÓÃruby´úÂë

#include < ruby.h > //
static int id_sum;
int Values[] = {5, 10 ,15,-1,20,0};
static VALUE wrap_sum(VALUE args)
{
 VALUE * values = (VALUE *) args;
 VALUE summer = values[0]; 
 VALUE max = values[1];
 return rb_funcall(summer,id_sum,1,max);
}
static VALUE ......

ʹÓÃCDHtmlDialog £¬ÊµÏÖjavascript µ÷ÓÃC++

.h Îļþ
class CHtmlSkinDlg : public CDHtmlDialog
{
      ¡£¡£¡£¡£¡£
    DECLARE_DISPATCH_MAP()     
//  !!! ¸²¸Ç»ùÀàµÄÕâ¸ö·½·¨
BOOL CanAccessExternal()
    {
        ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ