Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Óà PHP ¶ÁÈ¡ºÍ±àд XML DOM


Óà PHP ¶ÁÈ¡ºÍ±àд XML DOM
ʹÓà DOM ¿â¡¢SAX ½âÎöÆ÷ºÍÕýÔò±í´ïʽ
ÓÐÐí¶à¼¼Êõ¿ÉÓÃÓÚÓà 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 °üº¬Ò»¸öͼÊéÁÐ±í¡£¸¸±ê¼Ç <books>
°üº¬Ò»×é <book>
±ê¼Ç£¬Ã¿¸ö <book>
±ê¼ÇÓÖ°üº¬ <author>
¡¢<title>
ºÍ <publisher>
±ê¼Ç¡£
µ± XML ÎĵµµÄ±ê¼Ç½á¹¹ºÍÄÚÈݵõ½ÍⲿÄ


Ïà¹ØÎĵµ£º

JSPÖÐʹÓÃXMLʵÏÖµ¯³öʽ²Ëµ¥

Ó¦ÓÃJSP£¬XMLºÍCSS¼¼ÊõʵÏÖµ¯³öʽ²Ëµ¥µÄ¹¤³Ì¿ò¼Ü¡£
  ×ۺϲÉÓÃJSP£¬JavaBean£¬XML£¬XSL£¬CSS£¬JavaScript¶àÏî¼¼ÊõµÄÓŵ㡣
  ÔÚJSPÖÐʹÓÃXMLÎĵµ£¬XML¶¨ÒåÊý¾Ý¸ñʽ£¬ÔÚJSPÖÐÖ±½ÓÉú³ÉXMLÎļþ£¬ËüÓëJavaBean½»»¥£¬JavaBean¸ºÔð¶ÁÈ¡´æ´¢²Ëµ¥ÏîµÄÎļþ¡£
XSLʵÏÖXMLµ½HTMLµÄת»¯£¬CSSÎļþ¸ºÔðÑùʽµ¥µÄ¶¨Ò壬¶øJavaS ......

PHPʵÏÖ¼òµ¥MVC¹¹Ïë


< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
......

xml¼ò¼Ç

SGML¹ýÓÚ¸´ÔÓ£¬¹Ø¼üÖ®´¦»¹ÔÚÓÚÖ÷Á÷ä¯ÀÀÆ÷³§É̲»Ö§³ÖSGML£¬webÓ¦ÓúܺÃ
Little version£ºXML
html => xhtml =>xml¿ÉÒÔÀí½â³ÉÊÇÒ»¸ö¹ý¶ÉµÄ¹ý³Ì
SGMLµÄÉè¼ÆÀíÄî¾ÍÊÇ°ÑÎı¾µÄÄÚÈݺÍÑùʽ·Ö¿ª£¬×ÔÈ»xmlÒ²ÊÇÈç´Ë¡£
xmlÒ»°ã°üÀ¨ÒÔÏÂÎļþ£º
DTD-->schema(xsd) ¶¨ÒåÎĵµ½á¹¹µÈ£¨ÄÚÈÝ£©
CSS-->XSLT (Ñùʽ)
xml ---- ......

XmlÖÐSelectSingleNode·½·¨ÖеÄxpathÓ÷¨

×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.  
 
   Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.  
 
   Attribute, Ö¸ÔÚ<Employee >Ö ......

PHPÉú³ÉwordÎĵµ

ÕâÀïÖ»ÊÇÒ»¸öÀý×Ó£¬ÓÃPHPÉú³ÉÊý¾Ý×ÖµäµÄÀý×Ó£¬ÊʺÏÀÁÈË
<?php
/*
   +----------------------------------------------------------------------+
   | base: Yang Yu <yangyu@sina.cn>    create@2009-5-18        |
   | ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ