ÔÚVisual C#ÖÐʹÓÃXMLÖ¸ÄÏÖ®¶ÁÈ¡XML
ÎÒÃǽñÌìÀ´½²Ò»Ï¸ÃÌåϵ½á¹¹ÖеÄXmlTextReaderÀ࣬¸ÃÀàÌṩ¶ÔXmlÎļþ½øÐжÁÈ¡µÄ¹¦ÄÜ£¬Ëü¿ÉÒÔÑéÖ¤ÎĵµÊÇ·ñ¸ñʽÁ¼ºÃ£¬Èç¹û²»ÊǸñʽÁ¼ºÃµÄXmlÎĵµ£¬¸ÃÀàÔÚ¶ÁÈ¡¹ý³ÌÖн«»áÅ׳öXmlExceptionÒì³££¬¿ÉʹÓøÃÀàÌṩµÄһЩ·½·¨¶ÔÎĵµ½Úµã½øÐжÁÈ¡£¬É¸Ñ¡µÈ²Ù×÷ÒÔ¼°µÃµ½½ÚµãµÄÃû³ÆºÍÖµ£¬ÇëÀμǣºXmlTextReaderÊÇ»ùÓÚÁ÷Ä£Ð͵ÄʵÏÖ£¬´ò¸ö²»Ç¡µ±µÄ±ÈÓ÷£¬XMLÎļþ¾ÍºÃÏóˮԴ£¬Õ¢Ò»¿ªË®¾ÍÁ÷³ö£¬Á÷¹ýÁ˾ÍÁ÷¹ýÁ˲»»áÒ²²»¿ÉÒÔÍù»ØÁ÷¡£ÄÚ´æÖÐÈκÎʱºòÖ»Óе±Ç°½Úµã£¬Äã¿ÉÒÔʹÓÃXmlTextReaderÀàµÄRead()·½·¨¶ÁÈ¡ÏÂÒ»¸ö½Úµã¡£ºÃÁË£¬ËµÁËÕâô¶àÀ´¿´Ò»¸öÀý×Ó£¬±à³ÌҪעÖØʵ¼Ê¶Ô°É¡£¿´´úÂëÇ°ÏÈ¿´ÏÂÔËÐÐЧ¹û°É£¡
¡¡¡¡Example1°´Å¦±éÀúÎĵµ¶ÁÈ¡Êý¾Ý£¬Example2£¬Example3°´Å¦µÃµ½½ÚµãÀàÐÍ£¬Example4¹ýÂËÎĵµÖ»»ñµÃÊý¾ÝÄÚÈÝ£¬Example5µÃµ½ÊôÐԽڵ㣬Example6°´Å¦µÃµ½ÃüÃû¿Õ¼ä£¬Example7ÏÔʾÕû¸öXMLÎĵµ£¬Îª´Ë£¬ÎÒרÃÅдһ¸öÀàÀ´·â×°ÒÔÉϹ¦ÄÜ£¬¸ÃÀà´úÂëÈçÏ£º
//---------------------------------------------------------------------------------------------------
//XmlReaderÀàÓÃÓÚXmlÎļþµÄÒ»°ã¶ÁÈ¡²Ù×÷£¬ÒÔ϶ÔÕâ¸öÀà×ö¼òµ¥½éÉÜ£º
//
//Attributes(ÊôÐÔ):
//listBox: ÉèÖøÃÊôÐÔÖ÷ҪΪÁ˵õ½¿Í»§¶Ë¿Ø¼þÒÔ±ãÓÚÏÔʾËù¶Áµ½µÄÎļþµÄÄÚÈÝ(ÕâÀïÊÇListBox¿Ø¼þ)
//xmlPath: ÉèÖøÃÊôÐÔΪÁ˵õ½Ò»¸öÈ·¶¨µÄXmlÎļþµÄ¾ø¶Ô·¾¶
//
//Basilic Using(ÖØÒªµÄÒýÓÃ):
//System.Xml: ¸ÃÃüÃû¿Õ¼äÖзâ×°ÓжÔXml½øÐвÙ×÷µÄ³£ÓÃÀ࣬±¾ÀàÖÐʹÓÃÁËÆäÖеÄXmlTextReaderÀà
//XmlTextReader: ¸ÃÀàÌṩ¶ÔXmlÎļþ½øÐжÁÈ¡µÄ¹¦ÄÜ£¬Ëü¿ÉÒÔÑéÖ¤ÎĵµÊÇ·ñ¸ñʽÁ¼ºÃ£¬Èç¹û²»ÊǸñʽ // Á¼ºÃµÄXmlÎĵµ£¬¸ÃÀàÔÚ¶ÁÈ¡¹ý³ÌÖн«»áÅ׳öXmlExceptionÒì³££¬¿ÉʹÓøÃÀàÌṩµÄ
// һЩ·½·¨¶ÔÎĵµ½Úµã½øÐжÁÈ¡£¬É¸Ñ¡µÈ²Ù×÷ÒÔ¼°µÃµ½½ÚµãµÄÃû³ÆºÍÖµ
//
//bool XmlTextReader.Read(): ¶ÁÈ¡Á÷ÖÐÏÂÒ»¸ö½Úµã£¬µ±¶ÁÍê×îºóÒ»¸ö½ÚµãÔٴε÷Óø÷½·¨¸Ã·½·¨·µ»Øfalse
//XmlNodeType XmlTextReader.NodeType: ¸ÃÊôÐÔ·µ»Øµ±Ç°½ÚµãµÄÀàÐÍ
// XmlNodeType.Element ÔªËؽڵã
// XmlNodeType.EndElement ½áβԪËؽڵã
// XmlNodeType.XmlDeclaration ÎĵµµÄµÚÒ»¸ö½Úµã
// XmlNodeType.Text Îı¾½Úµã
//bool XmlTextReader.HasAttributes: µ±Ç°½ÚµãÓÐûÓÐÊôÐÔ£¬·µ»Øtrue»òfalse
//string XmlTextReader.Name: ·µ»Øµ±Ç°½ÚµãµÄÃû³Æ
//string XmlTextReader.Value: ·µ»Øµ±Ç°½ÚµãµÄÖµ
//string XmlTextReader.LocalName: ·µ»Øµ±Ç°
Ïà¹ØÎĵµ£º
xmlÎļþÈçÏ ÅäÖù¦ÄÜ¿ª¹Ø
<Configurations>
<Samples>true</Samples>
<Excepts>true</Excepts>
<CheckFace>false</CheckFace>
<ThumbNail>false</ThumbNail>
&nbs ......
protected void Page_Load(object sender, EventArgs e)
{
try
{
&nbs ......
libxml£¨Ò»£©
ÕªÒª
LibxmlÊÇÒ»¸öÓÐÃâ·ÑÐí¿ÉµÄÓÃÓÚ´¦ÀíXML¡¢¿ÉÒÔÇáËÉ¿çÔ ......
XMLÊÇÃÅѧÎÊ¡£ÒªÑ§µÄ»°¡£Ò²ÐèÒªÓÃÐÄ¡£
¼òµ¥µÄÁ˽âÏ¡£¡£
Àý×Ó£ºËùÓнڵã×ֶμ¸ºõ×Ô¼º¹¹Ôì¡£
<?xml version="1.0" encoding="utf-8" ?><!--Õâ¸öÊDZêʶ¡£¡£Ö¸¶¨°æ±¾¡£¡£Ö¸¶¨±àÂë¶Áд>
<ShowList>
<Movie>
<Name>¹¦·ò</Name>
<Poster>gongfu. ......