libxml2ÈçºÎ»ñµÃxmlµÄ×Ö·û´®£¿ - C/C++ / CÓïÑÔ
C/C++ code: xmlDocPtr doc; char *tt = "<?xml version='1.0'?><class version='1.0'><sigcode for='actions'></sigcode><actions><copy></copy></actions></class>"; doc = xmlReadMemory(tt,strlen(tt),NULL,"UTF-8",XML_PARSE_RECOVER); ÎÒÏÖÔÚÓÃC²Ù×÷libxml2£¬¾ÍÊÇ´ÓxmlDocPtrÖлñµÃ Õû¸öXMLµÄ×Ö·û´®ÐÅÏ¢¡£ ¼ÓÔØÊÇÕâÑùÁË£¬ÈçºÎÔÙ´ÓdocÀï»ñµÃ×Ö·û´®ÄØ£¿ Èç¹ûÎÊÌâ½â¾öÁË£¬ÎÒ²»»áÁߨķֵÄo_@!
End_rbody_64850864//--> ¸Ã»Ø¸´ÓÚ2010-04-24 08:35:37±»¹ÜÀíԱɾ³ý ¶ÔÎÒÓÐÓÃ[0] ¶ª¸ö°åש[0] ÒýÓà ¾Ù±¨ ¹ÜÀí TOP mysuli312 (mysuli312) µÈ¡¡¼¶£º #2Â¥ µÃ·Ö£º95»Ø¸´ÓÚ£º2010-04-21 19:26:54 ÒýÓà ÄãÈ·ÐÅÄãÏëÒªµÄÊÇÄǸö×Ö·û´®Â𣿠ÓÃÕâ¸ö xmlNodePtr root_element = xmlDocGetRootElement(doc); Äã¾Í¿ÉÒԵõ½¸ù½ÚµãÁË£¬È»ºó½øÐÐÐèÒªµÄ²Ù×÷¡£Èç¹ûÏëÒª×Ö·û´®µÄ»°£¬Äã¸ù±¾Ã»ÓбØÒªÏȷŵ½ docÀï ÎÞÂÛ´ÓÎļþÖжÁ³öÀ´£¬»¹ÊÇ´ÓÄÚ´æÖеõ½£¬¶¼²»ÓÃÔÚXMLÀïתһȦ ÎÒÒ²²»ÏëתһȦµÄ£¬ÎÒÒª´´½¨Ò»¸öXML£¬¶øÇÒ¶ÔÆä½øÐÐÐ޸쬲åÈëµÈ²Ù×÷£¬ ×îºó²»ÐèҪдÈëÓ²ÅÌ£¬Ò²²»ÄÜдÈëÓ²ÅÌ£¬¶øÖ±½ÓÒª»ñµÃXMLÀïÃæµÄÄÚÈÝ¡£ »ñµÃ¸ù½ÚµãÎÒÒ²ÖªµÀ£¬ÏÖÔÚ¾ÍÊÇÏë´ÓdocÖлñµÃÀïÃæµÄXMLÄÚÈÝ¡£ ¼ÇµÃÓиöÀàËÆxmlWriteMemoryµÄ£¬¾Í¿ÉÒÔÖ±½ÓдÄÚ´æÀïÁË xmlDocDumpFormatMemoryEnc ÓÃÕâ¸öº¯Êý£¬ÕÒµ½ÁË
Ïà¹ØÎÊ´ð£º
ÈçÌ⣬C/C++ÖеÄexeclÔõôµ÷ÓÃдºÃµÄjava³ÌÐò£¬ execl("/opt/java1.5/bin/java","MyClass",NULL); ÕâÑùµÄ²»ÐÐŶ¡£ ²»»á. ÔËÐÐjava³ÌÐò ÕÒ¹¤¾ß²é¿´Ò»ÏÂÄǸö³ÌÐòµÄÃüÁîÐÐ ËÑË÷Ï£ºjni ......
Private Sub Command1_Click() Dim MyString() As String Open "a.xml" For Binary As #1 ' ´ò¿ª¸Õ´´½¨µÄÎļþ¡£ ReDim MyString(LOF(1) - 1) Put #1, , MyRecord ' ¶ÁÈëËùÓÐ×Ö·ûµ½±äÁ¿ÖÐ ......
ÎÒÓÐÒ»¸öÀàËÆµÄxmlµÄ string£¬Ïëͨ¹ý±éÀúÔõô¸öxml Êä³öÎÒÏëÒªµÄelementµÄÖµ xml Ϊ£º <Discover xmlns="urn:schemas-microsoft-com:xml-analysis"> <RequestType>DISCOVER_XML_ME ......
ÏÖÔÚÓиöxmlÎļþÊÇ<?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xm ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎͼ¿É¡£ ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù. °¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿ ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......