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

xml»ù´¡

Ò»XML ½âÎöÆ÷
´ó¶àÊýä¯ÀÀÆ÷¶¼ÓжÁÈ¡ºÍ²Ù×÷ XML µÄÄÚ½¨ XML ½âÎöÆ÷¡£
½âÎöÆ÷°Ñ XML ת»»Îª JavaScript ¿É·ÃÎʵĶÔÏó¡£
½âÎö XML
ËùÓÐÏÖ´úä¯ÀÀÆ÷¶¼ÓжÁÈ¡ºÍ²Ù×÷ XML µÄÄÚ½¨ XML ½âÎöÆ÷¡£
½âÎöÆ÷°Ñ XML ÔØÈëÄڴ棬Ȼºó°ÑËüת»»Îª¿Éͨ¹ý JavaScript ·ÃÎ浀 XML DOM ¶ÔÏó¡£
Äú½«ÔÚ±¾½Ì³ÌµÄÏÂÒ»½ÚÖÐѧϰ¸ü¶àÓÐ¹Ø XML DOM µÄ֪ʶ¡£
΢ÈíµÄ XML ½âÎöÆ÷ÓëÆäËûä¯ÀÀÆ÷ÖеĽâÎöÆ÷Ö®¼ä£¬´æÔÚһЩ²îÒ졣΢ÈíµÄ½âÎöÆ÷Ö§³Ö XML ÎļþºÍ XML ×Ö·û´®£¨Îı¾£©µÄ¼ÓÔØ£¬¶øÆäËûä¯ÀÀÆ÷ʹÓõ¥¶ÀµÄ½âÎöÆ÷¡£²»¹ý£¬ËùÓеĽâÎöÆ÷¶¼°üº¬±éÀú XML Ê÷¡¢·ÃÎʲåÈ뼰ɾ³ý½Úµã£¨ÔªËØ£©¼°ÆäÊôÐԵĺ¯Êý¡£
ÔÚ±¾½Ì³ÌÖУ¬ÎÒÃǽ«ÎªÄúչʾÈçºÎ´´½¨¿Éͬʱ¹¤×÷ÓÚ Internet Explorer ºÍÆäËûä¯ÀÀÆ÷ÖеĽű¾¡£
×¢ÊÍ£ºµ±ÎÒÃÇ̸¼° XML ½âÎö£¬ÎÒÃdz£³£»áʹÓÃÓÐ¹Ø XML ÔªËØµÄÊõÓ½Úµã¡£
ͨ¹ý΢ÈíµÄ XML ½âÎöÆ÷À´¼ÓÔØ XML
΢ÈíµÄ XML ½âÎöÆ÷ÄÚ½¨ÓÚ Internet Explorer 5 ÒÔ¼°¸ü¸ßµÄ°æ±¾ÖС£
ÏÂÃæµÄ JavaScript Ƭ¶Î°ÑÒ»¸ö XML ÎĵµÔØÈë½âÎöÆ÷ÖУº
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("note.xml");
Àý×Ó½âÊÍ£º
ÉÏÃæ´úÂëµÄµÚÒ»¸öÐд´½¨Ò»¸ö¿ÕµÄ΢Èí XML Îĵµ¶ÔÏó¡£
µÚ¶þÐйرÕÒì²½¼ÓÔØ£¬ÕâÑùÈ·±£ÔÚÎĵµÍêÈ«¼ÓÔØÖ®Ç°½âÎöÆ÷²»»á¼ÌÐø½Å±¾µÄÖ´ÐС£
µÚÈýÐиæÖª½âÎöÆ÷¼ÓÔØÃûΪ "note.xml" µÄ XML Îĵµ¡£
ÏÂÃæµÄ JavaScript Ƭ¶Î°Ñ×Ö·û´® txt ÔØÈë½âÎöÆ÷£º
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(txt);
×¢ÊÍ£ºloadXML() ·½·¨ÓÃÓÚ¼ÓÔØ×Ö·û´®£¨Îı¾£©£¬load() ÓÃÓÚ¼ÓÔØÎļþ¡£
ÔÚ Firefox ¼°ÆäËûä¯ÀÀÆ÷ÖÐµÄ XML ½âÎöÆ÷
ÏÂÃæµÄ JavaScript Ƭ¶Î°Ñ XML Îĵµ ("note.xml") ÔØÈë½âÎöÆ÷£º
var xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.async="false";
xmlDoc.load("note.xml");
Àý×Ó½âÊÍ£º
ÉÏÃæ´úÂëµÄµÚÒ»¸öÐд´½¨Ò»¸ö¿ÕµÄ XML Îĵµ¶ÔÏó¡£
µÚ¶þÐйرÕÒì²½¼ÓÔØ£¬ÕâÑùÈ·±£ÔÚÎĵµÍêÈ«¼ÓÔØÖ®Ç°½âÎöÆ÷²»»á¼ÌÐø½Å±¾µÄÖ´ÐС£
µÚÈýÐиæÖª½âÎöÆ÷¼ÓÔØÃûΪ "note.xml" µÄ XML Îĵµ¡£
ÏÂÃæµÄ JavaScript Ƭ¶Î°Ñ×Ö·û´® txt ÔØÈë½âÎöÆ÷£º
var parser=new DOMParser();
var doc=parser.parsefromString(txt,"text/xml");
Àý×Ó½âÊÍ£º
ÉÏÃæ´úÂëµÄµÚÒ»¸öÐд´½¨Ò»¸ö¿ÕµÄ΢Èí XML Îĵµ¶ÔÏó¡£
µÚ¶þÐиæÖª½âÎöÆ÷ÔØÈëÃûΪ txt µÄ×Ö·û´®¡£
×¢ÊÍ£ºInternet Explore


Ïà¹ØÎĵµ£º

XMLÎļþ°ó¶¨Êý¾Ý¼¯¿Ø¼þ²Ù×÷

//Êý¾Ý°ó¶¨
    public void DataBind()
    {
        DataSet ds = new DataSet();
        ds.ReadXml(Server.MapPath(@"App_data/dbGuest.xml"));
&nbs ......

XPath,XMLÎĵµ,SelectNodes()ͨÅä·û˵Ã÷


ÀûÓÃXPath¶ÁÈ¡XmlÎļþ
Ö®ËùÒÔÒªÒýÈëXPathµÄ¸ÅÄĿµÄ¾ÍÊÇΪÁËÔÚÆ¥ÅäXMLÎĵµ½á¹¹Ê÷ʱÄܹ»×¼È·µØÕÒµ½Ä³Ò»¸ö½ÚµãÔªËØ¡£¿ÉÒÔ°ÑXPath±È×÷Îļþ¹ÜÀí·¾¶£ºÍ¨¹ýÎļþ¹ÜÀí·¾¶£¬¿ÉÒÔ°´ÕÕÒ»¶¨µÄ¹æÔò²éÕÒµ½ËùÐèÒªµÄÎļþ£»Í¬Ñù£¬ÒÀ¾ÝXPathËùÖÆ¶¨µÄ¹æÔò£¬Ò²¿ÉÒԺܷ½±ãµØÕÒµ½XML½á¹¹ÎĵµÊ÷ÖеÄÈκÎÒ»¸ö½Úµã.
¡¡¡¡²»¹ý£¬ÓÉÓÚXPath¿ÉÓ¦Ó ......

jdom¶ÁÈ¡xmlÎļþ


import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
£¨1£©Ê¹ÓÃJDOMÊ×ÏÈÒªÖ¸¶¨Ê¹ÓÃʲô½âÎöÆ÷¡£È磺
          SAXBuilder builder=new SAXBuilder(false) ......

java ÀûÓÃXSD ÑéÖ¤XMLÎļþ

XSDÎļþ £¨XML Schema ÓïÑÔÒ²³Æ×÷ XML Schema ¶¨Ò壨XML Schema Definition£¬XSD£©¡£ ¾ßÌåʹÓ÷½·¨ºÍ¶¨ÒåÇë²Î¿´£º
http://www.w3school.com.cn/schema/index.asp
java×Ôjdk1.5ÒÔÉÏÐÂÔöÁËSchemaFactoryÀà ¿ÉÒÔʵÏÖ¶ÔXSDÑéÖ¤µÄÖ§³Ö£¬Ê¹ÓÃÆðÀ´Ò²ºÜ·½±ã¡£
ÒÔÏ´úÂë¿ÉÓÃÔÚJDK1.5+ ÑéÖ¤xml
public class SimpleErrorHandler i ......

XML Íêȫѧϰ½Ì³Ì


ʲôÊÇ XML?
XML Ö¸¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨EXtensible Markup Language£©
XML ÊÇÒ»ÖÖ±ê¼ÇÓïÑÔ£¬ºÜÀàËÆ HTML
XML µÄÉè¼Æ×ÚÖ¼ÊÇ´«ÊäÊý¾Ý£¬¶ø·ÇÏÔʾÊý¾Ý
XML ±êǩûÓб»Ô¤¶¨Òå¡£ÄúÐèÒª×ÔÐж¨Òå±êÇ©¡£
XML ±»Éè¼ÆÎª¾ßÓÐ×ÔÎÒÃèÊöÐÔ¡£
XML ÊÇ W3C µÄÍÆ¼ö±ê×¼
XML Óë HTML µÄÖ÷Òª²îÒì
XML ²»ÊÇ HTML µÄÌæ´ú¡£
XML ºÍ HTML Ϊ² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ