objective c xml½âÎö
½ñÌìÔÚCCÉÏ¿´µ½evangelÔÚÕÐÈË£¬ÉÏÃæдÁËÒ»ÌõÊý¾Ý½âÎö£¬ÎÒÏëÓ¦¸Ã¾ÍÊǶÔXMLµÄ½âÎö°É£¬ÔÝÇÒÕâÑùÀí½âÁË£¬ºÇºÇ¡£ÏÂÎçËÑË÷ÁËÒ»µã¶«Î÷×Ô¼ºÅªÁËÒ»¸öXMLÈ»ºó¶Á¶Á¿´¿´£¬ÏÖÔÚ½ö½öÊǶÁ³öÁËһЩ¶«Î÷£¬Ïȱ£´æ´úÂ룬´ýºóÐø¸üУ¡
Õâ¸öÊÇÎÒ´´½¨µÄxmlÎļþ£¬ÓÃÓÚ²âÊÔÓõģº
<?xml version="1.0" encoding="UTF-8"?>
<book>
<book1>
<author>zhangsan</author>
<title>Hello this is book1</title>
<content>book1 is very good for testing!</content>
</book1>
<book2>
<author>lisi</author>
<title>Hello this is book2</title>
<content>book2 is very good for testing!</content>
</book2>
<book3>
<author>wangwu</author>
<title>Hello this is book3</title>
<content>book3 is very good for testing!</content>
</book3>
</book>
¶Ôxml½øÐнâÎöÐèҪʹÓÃNSXMLParserÀ࣬Ê×ÏÈÉùÃ÷Ò»¸öNSXMLParser¶ÔÏó
NSXMLParser *xmlRead;
NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"xml"];
NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path];
NSData *data = [file readDataToEndOfFile];//µÃµ½xmlÎļþ
[file closeFile];
xmlRead = [[NSXMLParser alloc] initWithData:data];//³õʼ»¯NSXMLParser¶ÔÏó
[data release];
[xmlRead setDelegate:self];//ÉèÖÃNSXMLParser¶ÔÏóµÄ½âÎö·½·¨´úÀí
BOOL success = [xmlRead parse];//µ÷ÓôúÀí½âÎöNSXMLParser¶ÔÏ󣬿´½âÎöÊÇ·ñ³É¹¦
//½âÎöÆ÷£¬´ÓÁ½¸ö½áµãÖ®¼ä¶ÁÈ¡ÄÚÈÝ
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
NSLog(string);
}
//»ñµÃ½áµã½áβµÄÖµ
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
NSLog(elementName);
}
//»ñµÃ½áµãÍ·µÄÖµ
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
Ïà¹ØÎĵµ£º
1£ºÈçºÎͨ¹ýsocket´úÀíÀ´·ÃÎÊ·þÎñ¶Ë£º
String proxyHost =
"192.168.204.212"
;
String proxyPort =
"1080"
;
//֪ͨJavaҪͨ¹ý´úÀí½øÐÐÁ¬½Ó¡£
ÕýÔÚ×°ÔØÊý¾Ý……
System.get ......
ÔÚºÏ×÷¿ª·¢Ê±£¬C#ʱ³£ÐèÒªµ÷ÓÃC++DLL£¬µ±´«µÝ²ÎÊýʱʱ³£Óöµ½ÎÊÌ⣬ÓÈÆäÊÇ´«µÝºÍ·µ»Ø×Ö·û´®ÊÇ£¬ÏÖ×ܽáһϣ¬·ÖÏí¸ø´ó¼Ò£º
VC++ÖÐÖ÷Òª×Ö·û´®ÀàÐÍΪ£ºLPSTR,LPCSTR, LPCTSTR, string, CString, LPCWSTR, LPWSTRµÈ
µ«×ªÎªC#ÀàÐÍÈ´²»ÍêÈ«Ïàͬ¡£
Ö÷ÒªÓÐÈçϼ¸ÖÖת»»£º
½«stringתΪIntPtr£ºIntPtr System.Runtime.InteropServ ......
°²×°eclipse-cpp-galileo-win32.zip
ÒÔÏÂÊÇ×îÐÂeclipse cpp ¿ª·¢IDE
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR1/eclipse-cpp-galileo-SR1-win32.zip
ÉèÖÃmake³ÌÐò
ÉèÖÃbinary parser
н¨Ò»¸öC++¹¤³Ì
±àдͷÎļþ
±àдʵÏÖ
¸ÄдMakefile ¡ ......
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define err(msg) perror(msg)
static void mkdirs(const char *dir)
{
char tmp[1024];
char *p;
&nbs ......
/* Offtimer.c.For auto halt. */
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#define DELAY 60/* Time of sleeping */
int main()
{
time_t now;
struct tm *p;
while(1)
{
now = time(NULL);
&n ......