[¹ØÓÚxmlÎļþ´¢´æÓÚ¶ÁÈ¡]
ÎÒÔÚ¶ÁÈ¡XmlÎļþµÄʱºòÔõÑùÈ¥Ö¸¶¨xmlÎļþ¶ÁÈ¡µÄ±àÂë¹æÔòÀýÈç(ÀýÈ磺ÓÃUnicode±àÂë×Ö·û¼¯È¥¶ÁÈ¡)
»¹ÓÐÎÒÄÜ·ñÖ¸¶¨ÒÔʲô±àÂë¹æÔòÈ¥´¢´æÎÒµÄxmlÎļþ
Çë¸øÏ´úÂë
»¹ÓÐ×îºóÒ»¸öÎÊÌâÊÇ£ºÎÒÔõÑùÄܹ»È¥ÈÃxmlµÄÌØÊâ×Ö·û£¨£¡@#£¤%£© ˳ÀûµÄ¶Áµ½DataGridView¿Ø¼þÀïѽ
¸ßÊÖÖ§Õаɣ¬¹À¼ÆÕâ¸öÎÊÌâ¸úÉϸöÎÊÌâ²î²»¶à ²»¹ý»¹ÊÇÇë½â´ðһϠÎÒʵÔÚ²»¶®
Ã»Íæ¹ý ¶¥Ò»Ï°É
XmlDocumentµÄLoadº¯ÊýÓиöÖØÔØ
Load(TextReader r)
StreamReader Ö¼ÔÚÒÔÒ»ÖÖÌØ¶¨µÄ±àÂëÊäÈë×Ö·û£¬¶ø Stream ÀàÓÃÓÚ×Ö½ÚµÄÊäÈëºÍÊä³ö
¶østreamReaderÊÇTextReaderµÄÅÉÉúÀà,ËùÒÔÎÒÃÇ¿ÉÒÔÓÃÖ¸¶¨µÄ±àÂë¸ñʽ¼ÓÔØXMLÎļþ
дÈë²ÉÓÃÌØ¶¨×Ö·û±àÂë·½·¨:
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.Default;
XmlWriter writer = XmlWriter.Create("X.XML", settings);
Íü¼Ç˵ÁË:
StreamReaderÓиöÖØÔØµÄ¹¹Ô캯ÊýÈçÏÂ:
XmlDocument doc = new XmlDocument();
StreamReader stream = new StreamReader("x.xml", Encoding.Default);
doc.Load(stream);
ÔÚXmlÎĵµµÄµÚÒ»¾ä,¾Í¿É¶¨Òå¶ÁÈ¡µÄ±àÂë!!
<?xml version="1.0" encoding="utf-8" ?>
......
<?xml version="1.0" encoding="utf-8"?>
StreamReader sr= new StreamReader("", Encoding
Ïà¹ØÎÊ´ð£º
Êý¾Ý¿â±íÖÐÓÐÒ»ÁУ¨TranXml£©ÀàÐÍÊÇxml£¬´æ´¢µÄÊÇÀàËÆ
<fathernode>
<a>aaa
</a>
<b>bbb
</b>
</fathernode>
µÄÐÅÏ¢£¬²¢ÇÒͨ¹ý²éѯ·½· ......
<?xml version="1.0" encoding="gb2312" ?>
<sites>
<site>
<name>.Net¿ª·¢ÕßÔ°µØ</name>
<url>http://dotnet.aspx.cc</url>
<img&g ......
ÈçºÎ¶ÔxmlÄÚÈÝÊý¾Ý½øÐбȽÏ
ÀýÈ磺
<?xml version='1.0' encoding='utf-8'?>
<TestLIST>
<PID>40</PID>
<TestName>ÉîÛÚÊÐ</TestName>
......
ÈçÌâ
ÎÒÕâѧÆÚÑ¡µÄ¿ÎÌâÊÇÕâ¸öµ«ÊDz»ÖªµÀ¸ÃÔõô׼±¸£¬µ¼Ê¦Ò²Ã»Ôõô˵Çå³þ£¬Ï£Íû¸÷λ´ïÈËÄÜÖ¸µãÒ»¶þ£¬Ð¡µÜÔÚÕâл¹ýÀ²£¡
ллÄã £¬ÎÒÏÖÔÚÒ²×Ô¼º¿´×ÊÁÏÕûÀíË¼Â·ÄØ£¬¾ßÌåµÄ»¹ÒªÒ»µãʱ¼ä¡£
ÒýÓÃ
˼·ÈçÏ£º
ʹÓà ......