Óà PHP ¶ÁÈ¡ºÍ±àд XML DOM
Óà PHP ¶ÁÈ¡ºÍ±àд XML DOM
ʹÓà DOM ¿â¡¢SAX ½âÎöÆ÷ºÍÕýÔò±í´ïʽ
ÎĵµÑ¡Ïî
´òÓ¡±¾Ò³
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
¼¶±ð£º Öм¶
Jack Herrington (jack_d_herrington@codegeneration.net), ¸ß¼¶Èí¼þ¹¤³Ìʦ, "Code Generation Network"
2006 Äê 2 ÔÂ 06 ÈÕ
ÓÐÐí¶à¼¼Êõ¿ÉÓÃÓÚÓà PHP ¶ÁÈ¡ºÍ±àд XML¡£±¾ÎÄÌṩÁËÈýÖÖ·½·¨¶ÁÈ¡ XML£ºÊ¹Óà DOM ¿â¡¢Ê¹Óà SAX ½âÎöÆ÷ºÍʹÓÃÕýÔò±í´ïʽ¡£»¹½éÉÜÁËʹÓà DOM ºÍ PHP Îı¾Ä£°å±àд XML¡£
Óà PHP ¶ÁÈ¡ºÍ±àд¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨XML£©¿´ÆðÀ´¿ÉÄÜÓеã¿Ö²À¡£Êµ¼ÊÉÏ£¬XML ºÍËüµÄËùÓÐÏà¹Ø¼¼Êõ¿ÉÄÜÊÇ¿Ö²ÀµÄ£¬µ«ÊÇÓà PHP ¶ÁÈ¡ºÍ±àд XML ²»Ò»¶¨ÊÇÏî¿Ö²ÀµÄÈÎÎñ¡£Ê×ÏÈ£¬ÐèҪѧϰһµã¹ØÓÚ XML µÄ֪ʶ —— ËüÊÇʲô£¬ÓÃËü×öʲô¡£È»ºó£¬ÐèҪѧϰÈçºÎÓà PHP ¶ÁÈ¡ºÍ±àд XML£¬¶øÓÐÐí¶àÖÖ·½Ê½¿ÉÒÔ×öÕâ¼þÊ¡£
±¾ÎÄÌṩÁË XML µÄ¼ò¶ÌÈëÃÅ£¬È»ºó½âÊÍÈçºÎÓà PHP ¶ÁÈ¡ºÍ±àд XML¡£
ʲôÊÇ XML£¿
XML ÊÇÒ»ÖÖÊý¾Ý´æ´¢¸ñʽ¡£ËüûÓж¨Òå±£´æʲôÊý¾Ý£¬Ò²Ã»Óж¨ÒåÊý¾ÝµÄ¸ñʽ¡£XML Ö»ÊǶ¨ÒåÁ˱ê¼ÇºÍÕâЩ±ê¼ÇµÄÊôÐÔ¡£¸ñʽÁ¼ºÃµÄ XML ±ê¼Ç¿´ÆðÀ´ÏñÕâÑù£º
<name>Jack Herrington</name>
Õâ¸ö <name> ±ê¼Ç°üº¬Ò»Ð©Îı¾£ºJack Herrington¡£
²»°üº¬Îı¾µÄ XML ±ê¼Ç¿´ÆðÀ´ÏñÕâÑù£º
<powerUp />
Óà XML ¶Ôij¼þʽøÐбàдµÄ·½Ê½²»Ö¹Ò»ÖÖ¡£ÀýÈ磬Õâ¸ö±ê¼ÇÐγɵÄÊä³öÓëÇ°Ò»¸ö±ê¼ÇÏàͬ£º
<powerUp></powerUp>
Ò²¿ÉÒÔÏò XML ±ê¼ÇÌí¼ÓÊôÐÔ¡£ÀýÈ磬Õâ¸ö <name> ±ê¼Ç°üº¬ first ºÍ last ÊôÐÔ£º
<name first="Jack" last="Herrington" />
Ò²¿ÉÒÔÓà XML ¶ÔÌØÊâ×Ö·û½øÐбàÂë¡£ÀýÈ磬& ·ûºÅ¿ÉÒÔÏñÕâÑù±àÂ룺
&
°üº¬±ê¼ÇºÍÊôÐ﵀ XML ÎļþÈç¹ûÏñʾÀýÒ»Ñù¸ñʽ»¯£¬¾ÍÊǸñʽÁ¼ºÃµÄ£¬ÕâÒâζ×űê¼ÇÊǶԳƵģ¬×Ö·ûµÄ±àÂëÕýÈ·¡£Çåµ¥ 1 ÊÇÒ»·Ý¸ñʽÁ¼ºÃµÄ XML µÄʾÀý¡£
Çåµ¥ 1. XML ͼÊéÁбíʾÀý
<books>
<book>
<author>Jack Herrington</author>
<title>PHP Hacks</title>
<publisher>O'Reilly</publisher>
</book>
<book>
<author>Jack Herrington</author>
<title>Podcasting Hacks</title>
<publisher>O'Reilly</publisher>
</book>
</books>
Çåµ¥ 1 ÖÐµÄ XML °üº¬Ò»¸öͼÊéÁÐ
Ïà¹ØÎĵµ£º
Output Control º¯Êý¿ÉÒÔÈÃÄã×ÔÓÉ¿ØÖƽű¾ÖÐÊý¾ÝµÄÊä³ö¡£Ëü·Ç³£µØÓÐÓã¬ÌرðÊǶÔÓÚ£ºµ±ÄãÏëÔÚÊý¾ÝÒѾÊä³öºó£¬ÔÙÊä³öÎļþÍ·µÄÇé¿ö¡£Êä³ö¿ØÖƺ¯Êý²»¶ÔʹÓà header() »ò setcookie(), ·¢Ë͵ÄÎļþÍ·ÐÅÏ¢²úÉúÓ°Ïì,Ö»¶ÔÄÇЩÀàËÆÓÚ echo() ºÍ PHP ´úÂëµÄÊý¾Ý¿éÓÐ×÷Óá£
ÎÒÃÇÏȾÙÒ»¸ö¼òµ¥µÄÀý×Ó£¬Èôó¼Ò¶ÔOutput ControlÓÐÒ»¸ö´ ......
ÔÚwindowsÏ°²×°image magic µÄphpÀ©Õ¹ imagick, Ê×ÏÈÐèÒªÏÂÔØphp_imagick.dllÎļþ.Õâ¸ödllÎļþ·Ç³£¹Ø¼ü.
Èç¹ûÏÂÔØÁË´íÎóµÄphp_imagick.dll.°²×°¾Í»áʧ°Ü.ÎÒ¾ÍÊÇÏÂÔØÁËN¸öÕâÑùµÄdllÎļþ¶¼Î´ÄÜ°²×°³É¹¦.×îºóÖÕÓÚ¸øÎÒÕÒµ½ÕýÈ·µÄdllÎļþÁË
ÏÂÔصØÖ·:http://valokuva.org/outside-blog-content/imagick-windows-builds ......
×Ô¼º×öÏîÄ¿ÐèÒªÓÃÖÇÄÜ¿Í»§¶Ë·¢²¼£¬ÎÒÓöµ½Á˸öÎÊÌâ¾ÍÊdzÌÐòÖеÄxmlÎļþÔÚ·¢²¼ºóÕÒ²»µ½ÁË¡£¾¹ýÔÚÍøÉϲéѯºÍ×Ô¼ºµÄÊÔÑé·¢ÏÖÕâÁ½¸ö·½·¨¶¼¿ÉÒÔ½â¾öÕâ¸öÎÊÌâ¡£
·½·¨1
ÓÒ¼üwinUIÏîÄ¿£¬·¢²¼-¡µÓ¦ÓóÌÐòÎļþ....->Ñ¡ÔñxmlÎļþ-¡µ·¢²¼×´Ì¬¸ÄΪ“Êý¾ÝÎļþ(×Ô¶¯)”
&nb ......
ǶÈëʽGUI FTK½éÉÜ(3)-XML½çÃæÃèÊöÓïÑÔ
תÔØʱÇë×¢Ã÷³ö´¦ºÍ×÷ÕßÁªÏµ·½Ê½
ÎÄÕ³ö´¦£ºhttp://www.limodev.cn/blog
×÷ÕßÁªÏµ·½Ê½£ºÀîÏȾ² <xianjimli at hotmail dot com>
ÓÃXMLÀ´ÃèÊö½çÃ棬C/C++дÄÚ²¿Âß¼£¬Óýű¾ÓïÑÔÀ´½ººÏ½çÃæºÍÄÚ²¿Âß¼¡£FTKÕýÊÇ»ùÓÚÕâÖÖ˼ÏëÀ´Éè¼ÆµÄ£¬ËùÒÔËü×ÔÈ»»áÌṩ XML½çÃæÃèÊö¹¦ÄÜ£¬ÔÚ ......
1. ¶ÔµÝ¹éµÄ²»Á¼Ö§³Ö
µÝ¹éÊÇÒ»ÖÖº¯Êýµ÷ÓÃ×ÔÉíµÄ»úÖÆ¡£ÕâÊÇÒ»ÖÖÇ¿´óµÄÌØÐÔ¿ÉÒÔ°ÑijЩ¸´ÔӵĶ«Î÷±äµÃºÜ¼òµ¥¡£ÓÐÒ»¸öʹÓõݹéµÄÀý×ÓÊÇ¿ìËÙÅÅÐò£¨quicksort£©¡£²»ÐÒµÄÊÇ£¬PHP²¢²»Éó¤µÝ¹é¡£Zeev£¬Ò»¸öPHP¿ª·¢ÈËÔ±£¬ËµµÀ£º“PHP 4.0£¨Zend£©¶ÔÃܼ¯Êý¾ÝʹÓÃÁËÕ»·½Ê½£¬¶ø²»ÊÇʹÓöѷ½Ê½¡£Ò²¾ÍÊÇ˵ËüÄÜÈÝÈ̵ĵݹ麯ÊýµÄÊýÁ¿ÏÞ ......