C#ÖÐÓÃXmlDocument¶ÔÏó»ñÈ¡XMLÎļþÖеĽڵãÖµ
xmlÎļþ:
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
<book>
<title lang="eng">Harry Potter</title>
<price>29.99</price>
</book>
<book>
<title lang="eng">Learning XML</title>
<price>39.98</price>
</book>
<bookstore>
<title lang="eng">Learning C#</title>
<price>55.23</price>
</bookstore>
<item name="1">µÚÒ»¸öitem</item>
<item name="2">
<item name="1">Õâ¸ö½áµã(1)</item>
<item name="2">Õâ¸ö½áµã(2)</item>
<book>
<title lang="cn">Learning C</title>
<price>60.95</price>
</book>
</item>
</bookstore>
XmlDocument xdoc = new XmlDocument();
xdoc.Load(Server.MapPath("books.xml"));
XmlNodeList xnl = xdoc.SelectNodes("/bookstore/book");
string nodeTempStr = "";
foreach (XmlNode node in xnl)
{
nodeTempStr = node.InnerText;
node
Ïà¹ØÎĵµ£º
C#×é¼þ¿ª·¢ÈËÔ±
ʲôʱºòʹÓÃoverride£¿Ê²Ã´Ê±ºòʹÓÃnew? ʲô½Ðshadowing?
ÖØд¸¸ÀàµÄ·½·¨µÄʱºòÓÃoverrideÒÔʵÏÖ¶à̬£¬µ±ÄãÏëÆÁ±Î¸¸Àà³ÉÔ±µÄʱºòʹÓÃnew£¬shadowing»ù±¾¾ÍÊÇnewÓëoverrideÇø±ðµÈһЩ·½ÃæµÄÎÊÌ⣬¸öÈËÈÏΪŪÇåoverrideÓënew¾ÍûÓбØÒªÌØÒ⿼ÂÇshadowing¡£
½âÊÍvirtual¡¢sealed¡¢overrideºÍabstractµÄ ......
ÒÔÇ°ÔÚ²©¿ÍÉÏ·¢¹ý£¬¾ÈËÌáÐÑDataSetÒÑ×Ô´ø¶ÁдXMLµÄ¹¦ÄÜ£¬ÓÚÊDZãɾÁË£¬
²»¹ýÔÚʵ¼ùÖиоõ·â×°Ò»²ãºó£¬Ê¹ÓÃÆðÀ´»¹ÊÇÂù·½±ãµÄ¡£¹ÊÔÙ´ÎÖØ·¢¡£
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;
using System.Xml;
namespace XmlDesign
{
class XmlDatasetC ......
XML DOM
XML DOM (XML Document Object Model) ¶¨ÒåÒ»Ì×·ÃÎʺͲÙ×÷ XML ÎĵµµÄ±ê×¼·½·¨¡£
DOM °Ñ XML Îĵµ×÷ΪÊ÷½á¹¹À´²é¿´¡£Äܹ»Í¨¹ý DOM Ê÷À´·ÃÎÊËùÓÐÔªËØ¡£¿ÉÒÔÐ޸Ļòɾ³ýËüÃǵÄÄÚÈÝ£¬²¢´´½¨ÐµÄÔªËØ¡£ÔªËØ£¬ËüÃǵÄÎı¾£¬ÒÔ¼°ËüÃǵÄÊôÐÔ£¬¶¼±»ÈÏΪÊǽڵ㡣
ÔÚÏÂÃæµÄÀý×ÓÖУ¬ÎÒÃÇʹÓà DOM ÒýÓÃ´Ó <to> ÔªËØÖлñÈ ......
<?xml version="1.0" encoding="gb2312" ?>
<?xml-stylesheet type="tet/css" href="mystyle.css" ?>
<%@ page errorPage="error.jap" %>
<%@ page contentType="text/xml" %>
<realmarid>
»ÊÂí»¨Ãû²á
<athlete>
<name>Æë´ïÄÚ</name>
<country> ......
Ò»¡¢½¨Á¢ÍøÒ³
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<script language="javascript" type="text/javascript">
<!-- Ìṩ¸øC#³ÌÐòµ÷Óõķ½·¨ -->
function messageBox(message)
{
alert(message);
}
</script>
</head>
& ......