C++½âÎöXML
ÓÃmingw32-makeÇ°ÐÞ¸ÄÒ»ÏÂmakefileÎļþ,¸ÄΪÈçÏÂ
# DEBUG can be set to YES to include debugging info, or NO otherwise(²»ÊÇDEBUG)
DEBUG := NO
# PROFILE can be set to YES to include profiling info, or NO otherwise
PROFILE := NO
# TINYXML_USE_STL can be used to turn on STL support. NO, then STL
# will not be used. YES will include the STL files.(ʹÓÃSTL,Ñ¡ÔñµÄ»°£¬Ôò¿ÉÒÔʹÓÃstd::string)
TINYXML_USE_STL := YES
Ò»¡¢ TinyXmlµÄÌصã
TinyXmlÊÇÒ»¸ö»ùÓÚDOMÄ£Ð͵ġ¢·ÇÑéÖ¤µÄÇáÁ¿¼¶C++½âÊÍÆ÷¡£
1. SAXºÍDOM
Ä¿Ç°XMLµÄ½âÎöÖ÷ÒªÓÐÁ½´óÄ£ÐÍ£ºSAXºÍDOM¡£
ÆäÖÐSAXÊÇ»ùÓÚʼþµÄ£¬Æä»ù±¾¹¤×÷Á÷³ÌÊÇ·ÖÎöXMLÎĵµ£¬µ±·¢ÏÖÁËÒ»¸öеÄÔªËØʱ£¬²úÉúÒ»¸ö¶ÔӦʼþ£¬²¢µ÷ÓÃÏàÓ¦µÄÓû§´¦Àíº¯Êý¡£ÕâÖÖ·½Ê½Õ¼ÓÃÄÚ´æÉÙ£¬Ëٶȿ죬µ«Óû§³ÌÐòÏàÓ¦µÃ»á±È½Ï¸´ÔÓ¡£
¶øDOM£¨Îĵµ¶ÔÏóÄ£ÐÍ£©£¬ÔòÊÇÔÚ·ÖÎöʱ£¬Ò»´ÎÐԵĽ«Õû¸öXMLÎĵµ½øÐзÖÎö£¬²¢ÔÚÄÚ´æÖÐÐγɶÔÓ¦µÄÊ÷½á¹¹£¬Í¬Ê±£¬ÏòÓû§ÌṩһϵÁеĽӿÚÀ´·ÃÎʺͱ༸ÃÊ÷½á¹¹¡£ÕâÖÖ·½Ê½Õ¼ÓÃÄÚ´æ´ó£¬ËÙ¶ÈÍùÍùÂýÓÚSAX£¬µ«¿ÉÒÔ¸øÓû§Ìṩһ¸öÃæÏò¶ÔÏóµÄ·ÃÎʽӿڣ¬¶ÔÓû§¸üΪÓѺá£
2. ÑéÖ¤ºÍ·ÇÑéÖ¤
¶ÔÓÚÒ»¸öÌض¨µÄXMLÎĵµ¶øÑÔ£¬ÆäÕýÈ·ÐÔ·ÖΪÁ½¸ö²ã´Î¡£Ê×ÏÈÊÇÆä¸ñʽӦ¸Ã·ûºÏXMLµÄ»ù±¾¸ñʽҪÇ󣬱ÈÈçµÚÒ»ÐÐÒªÓÐÉùÃ÷£¬±êÇ©µÄǶÌײã´Î±ØÐëÇ°ºóÒ»Öµȵȣ¬·ûºÏÕâЩҪÇóµÄÎļþ£¬¾ÍÊÇÒ»¸öºÏ¸ñµÄXMLÎļþ£¬³Æ×÷well-formatted¡£µ«³ý´ËÖ®Í⣬һ¸öXMLÎĵµÒòÆäÄÚÈݵIJ»Í¬»¹±ØÐëÔÚÓïÒåÉÏ·ûºÏÏàÓ¦µÄ±ê×¼£¬ÕâЩ±ê×¼ÓÉÏàÓ¦µÄDTDÎļþ»òÕßSchemaÎļþÀ´¶¨Ò壬·ûºÏÁËÕâЩ¶¨ÒåÒªÇóµÄXMLÎļþ£¬³Æ×÷valid¡£
Òò´Ë£¬½âÎöÆ÷Ò²·ÖΪÁ½ÖÖ£¬Ò»ÖÖÊÇÑéÖ¤µÄ£¬¼´»á¸ú¾ÝXMLÎļþÖеÄÉùÃ÷£¬ÓÃÏàÓ¦µÄDTDÎļþ¶ÔXMLÎļþ½øÐÐУÑ飬¼ì²éËüÊÇ·ñÂú×ãDTDÎļþµÄÒªÇó¡£ÁíÒ»ÖÖÊǺöÂÔDTDÎļþ£¬Ö»Òª»ù±¾¸ñʽÕýÈ·£¬¾Í¿ÉÒÔ½øÐнâÎö¡£
¾ÍÎÒËùÖª£¬ÑéÖ¤µÄ½âÎöÆ÷ͨ³£¶¼ÊDZȽÏÖØÁ¿¼¶µÄ¡£TinyXml²»Ö§³ÖÑéÖ¤£¬µ«ÊÇÌå»ýºÜС£¬ÓÃÔÚ½âÎö¸ñʽ½ÏΪ¼òµ¥µÄXMLÎļþ£¬±ÈÈçÅäÖÃÎļþʱ£¬ÌرðµÄºÏÊÊ¡£
¶þ¡¢ TinyXmlµÄ¹¹½¨ºÍʹÓÃ
1. »ñÈ¡
TinyXmlÊ×Ò³ÔÚhttp://www.grinninglizard.com/tinyxml/index.html£¬´ÓÕâÀï¿ÉÒÔÕÒµ½×îа汾µÄÔ´
Ïà¹ØÎĵµ£º
C++ÓëJavaÒìͬ
1¡¢Ö¸Õë¡ï¡ï¡ï¡ï¡ï
C C++ÖеÄÖ¸Õ룬ÌṩÁ˺ܴóµÄÁé»îÐÔ£¬µ«ÊÇÁé»îÒ²´øÀ´ÁËΣÏÕ£¬¶ÔÖ¸Õë²Ù×÷µÄ²»µ±ÈÝÒ×Ôì³ÉÄÚ´æ鶻òÊÇ¿ÕÐüÖ¸ÕëµÈÎÊÌâ¡£
JavaÈ¡ÏûÁËÖ¸Õë¡£µ«Êµ¼ÊÉÏ£¬javaÖÐÉùÃ÷µÄËùÓÐÒýÓÃÊý¾ÝÀàÐ͵ÄÃû³Æ£¬¿ÉÒÔÀí½âΪ¾ÍÊÇÒ»¸öÖ¸Õë¡£¸ÃÃû³Æ´æ´¢ÔÚÕ»ÄÚ´æÉÏ£¬Ö¸Ïò¶ÔÄÚ´æÉÏʹÓÃnew¿ª±ÙµÄ¿Õ¼ä¡£
È磺
int[] ......
Q:ʲôÊÇC·ç¸ñת»»£¿Ê²Ã´ÊÇstatic_cast, dynamic_cast ÒÔ¼° reinterpret_cast£¿Çø±ðÊÇʲô£¿ÎªÊ²Ã´Òª×¢Ò⣿
A:ת»»µÄº¬ÒåÊÇͨ¹ý¸Ä±äÒ»¸ö±äÁ¿µÄÀàÐÍΪ±ðµÄÀàÐÍ´Ó¶ø¸Ä±ä¸Ã±äÁ¿µÄ±íʾ·½Ê½¡£ÎªÁËÀàÐÍת»»Ò»¸ö¼òµ¥¶ÔÏóΪÁíÒ»¸ö¶ÔÏóÄã»áʹÓô«Í³µÄÀàÐÍת»»²Ù×÷·û¡£±ÈÈ磬ΪÁËת»»Ò»¸öÀàÐÍΪdouboleµÄ¸¡µãÊýµÄÖ¸Õëµ½ÕûÐÍ£º
......
Ö¸ÕëÊÇc/c++ÓïÑÔµÄÌØÉ«£¬¶øÊý×éÃûÓëÖ¸ÕëÓÐÌ«¶àµÄÏàËÆ£¬ÉõÖÁºÜ¶àʱºò£¬Êý×éÃû¿ÉÒÔ×÷ΪָÕëʹÓá£ÓÚÊǺõ£¬ºÜ¶à³ÌÐòÉè¼ÆÕ߾ͱ»¸ãºýÍ¿ÁË¡£¶øÐí¶àµÄ´óѧÀÏʦ£¬ËûÃÇÔÚcÓïÑԵĽÌѧ¹ý³ÌÖÐÒ²´íÎóµÃ¸øѧÉú½²½â£º\"Êý×éÃû¾ÍÊÇÖ¸Õë\"¡£ºÜÐÒÔË£¬ÎҵĴóѧÀÏʦ¾ÍÊÇÆäÖÐÖ®Ò»¡£Ê±ÖÁ½ñÈÕ£¬ÎÒÈÕ¸´Ò»ÈյؽøÐÐ×Åc/c++ÏîÄ¿µÄ¿ª·¢£¬¶øÉí± ......
C·ç¸ñ×Ö·û´®£º¶Ô×Ö·û´®½øÐвÙ×÷µÄ C º¯Êý¶¨ÒåÔÚÍ·Îļþ<cstring>ÖУ»
1. ×Ö·û´®¶¨Ò壺char* result£»
2. ×Ö·û´®µÄ×îºóÒ»¸ö×Ö·ûÊÇnull×Ö·û£¨'\0'£©£¬¿ÉÒÔͨ¹ýÕâ¸ö×Ö·ûÈ·¶¨×Ö·û´®µÄ½áβ¡£
3. strlen()·µ»ØµÄÊÇ×Ö·û´®µÄ´óС£»Òò´Ë£¬ ......
ÀûÓÃSocketʵÏÖC++ÓëFlexͨÐÅ
Ò»¡¢C++·þÎñÆ÷¶Ë
£¨ÓõÄÊÇVisual Studio 2008£¨05£¬03µÄÓ¦¸ÃÒ²¿ÉÒÔ£¬VC++µÄ¿ÉÄÜÐèÒªÉÔ΢¸Ä¶¯£©£©
´úÂëÈçÏ£º
#include <winsock2.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;
#pragma comment(lib,"ws2_32.lib ......