ÈçºÎʹÓÃObjective C½âÎöHTMLºÍXML
ʹÓÃObjective-C½âÎöHTML»òÕßXML£¬ÏµÍ³×Ô´øÓÐÁ½ÖÖ·½Ê½Ò»¸öÊÇͨ¹ýlibxml£¬Ò»¸öÊÇͨ¹ýNSXMLParser¡£²»¹ýÕâÁ½ÖÖ·½Ê½¶¼ÐèÒª×Ô¼ºÐ´ºÜ¶à±àÂëÀ´´¦ÀíץȡÏÂÀ´µÄÄÚÈÝ£¬¶øÇÒ²»ÊǺÜÖ±¹Û¡£
ÓÐÒ»¸ö±È½ÏºÃµÄÀà¿âhpple£¬ËüÊÇÒ»¸öÇáÁ¿¼¶µÄ°ü×°¿ò¼Ü£¬¿ÉÒԺܺõĽâ¾öÕâ¸öÎÊÌâ¡£ËüÊÇÓÃXPathÀ´¶¨Î»ºÍ½âÎöHTML»òÕßXML¡£
°²×°²½Ö裺
-¼ÓÈë libxml2 µ½ÄãµÄÏîÄ¿ÖÐ
Menu Project->Edit Project Settings
ËÑË÷ “Header Search Paths”
Ìí¼ÓÐ嵀 search path “${SDKROOT}/usr/include/libxml2″
Enable recursive option
-¼ÓÈë libxml2 library µ½ÄãµÄÏîÄ¿
Menu Project->Edit Project Settings
ËÑË÷ “Other Linker Flags”
Ìí¼ÓÐ嵀 search flag “-lxml2″
-½«ÏÂÃæhppleµÄÔ´´úÂë¼ÓÈëµ½ÄãµÄÏîÄ¿ÖÐ:
HTFpple.h
HTFpple.m
HTFppleElement.h
HTFppleElement.m
XPathQuery.h
XPathQuery.m
-XPathѧϰµØÖ·http://www.w3schools.com/XPath/default.asp
ʾÀý´úÂ룺
#import "TFHpple.h"
NSData *data = [[NSData alloc] initWithContentsOfFile:@"example.html"];
// Create parser
xpathParser = [[TFHpple alloc] initWithHTMLData:data];
//Get all the cells of the 2nd row of the 3rd table
NSArray *elements = [xpathParser search:@"//table[3]/tr[2]/td"];
// Access the first cell
TFHppleElement *element = [elements objectAtIndex:0];
// Get the text within the cell tag
NSString *content = [element content];
[xpathParser release];
[data release];
ÁíÍ⣬»¹ÓÐÒ»¸öÀàËƵĽâ¾ö·½°¸¿ÉÒԲο¼
ElementParser http://github.com/Objective3/ElementParser
Ïà¹ØÎĵµ£º
map
:¶¨ÒåÒ»¸ö¿Í»§¶ËͼÏñÓ³É䡣ͼÏñÓ³É䣨image-map£©Ö¸´øÓпɵã»÷ÇøÓòµÄÒ»·ùͼÏñ¡£
ÊôÐÔ£º
name£º Ϊ image-map ¹æ¶¨µÄÃû³Æ¡£
  ......
ÉÏÖÜÀÏ°å·ÖÏÂÀ´6¸öְλÈí¼þ¿ª·¢·½ÃæµÄְλ¸øÎÒ£¬ÒªÎÒ°´Ö°Î»ÒªÇóÑ°ÕÒºÏÊʵÄÈ˲š£¾ÓÈ»ÊÇC/C++!¾ÝÎÒËùÖª£¬ÔÚÈ˲ſâÖУ¬JAVA È˲ŵ¹ÊÇÓ¦Óо¡ÓУ¬Ñ§CµÄ£¬»¹ÊÇǶÈëʽ¿ª·¢µÄ¿ÉÕæµÄºÃÉÙ°¡¡£ÎÒÓÖ²»ÊÇŮ洣¬ÄѵÀÎÒ»áÔìÈ˲Åô£¿ÒªÇóÌõ¼þ»¹Õâô¸ß£¡
ÒÔÏÂÊÇ´óÁ¬Èí¼þÔ°¼¸¼ÒÖªÃûÍâÆóίÍÐÎÒÃÇÕÐƸµÄְλÐÅÏ¢¡£
Position 1 Èí¼þ¿ª·¢¹¤³Ìʦ ......
C/C++λ²Ù×÷
Ò»¡¢´«Í³µÄC·½Ê½Î»²Ù×÷£º
1.»ù±¾²Ù×÷£º
ʹÓÃÒ»¸öunsigned int±äÁ¿À´×÷ΪλÈÝÆ÷¡£
2.²Ù×÷·û£º
| °´Î»»ò²Ù×÷·û£ºresult=exp1|exp2;µ±exp1ºÍexp2ÖжÔӦλÖÐÖÁÉÙÓÐÒ»¸öΪ1ʱ£¬resultÖжÔӦλΪ1£¬·ñÔòΪ0¡£
& °´Î»Óë²Ù×÷·û£º£ºresult=exp1&exp2;µ±exp1ºÍexp2ÖжÔӦλȫΪ1ʱ ......
´´½¨Ð½ø³Ì£ºforkº¯Êý
1.1.1. forkº¯Êý¸Éʲô£¿
#include <sys/types.h>
#include <unistd.h>
pid_t fork(void);
‘fork()’º¯ÊýÓÃÓÚ´ÓÒÑ´æÔÚ½ø³ÌÖд´½¨Ò»¸öнø³Ì¡£Ð½ø³Ì³ÆΪ×Ó½ ......
1,³ÌÐò¿ØÖÆÖеĿØÖÆÁ÷Óï¾äÓÃÓÚ¿ØÖƸ÷¼ÆËã»ú²Ù×÷Ö´ÐеĴÎÐò¡£
ʲôÊÇ¿ØÖÆÁ÷Óï¾äÏëÁË°ëÌ죬ÔÀ´²»¹ýÊÇÕâЩ£¬if-elseÓï¾ä£¬else-ifÓï¾ä£¬switchÓï¾ä£¬whileÑ»·£¬forÑ»·£¬do-whileÑ»·µÈ¡£
2,»¨À¨ºÅ{}£¬ÆäÖеÄÓÒ»¨À¨ºÅÓÃÓÚ½áÊø³ÌÐò¿é£¬Æäºó²»ÐèÒª·ÖºÅ¡£
µ±³õÒ»¿´µ½“Æäºó²»ÐèÒª·ÖºÅµÄ”ʱºòÏëÁË°ëÌ ......