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

DataSet(DataTable)ÓëXML»¥×ª

using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Text;
// ÏàÓ¦C#´úÂ룺
private string ConvertDataTableToXML(DataTable xmlDS)
{
MemoryStream stream = null;
XmlTextWriter writer = null;
try
{
stream = new MemoryStream();
writer = new XmlTextWriter(stream, Encoding.Default);
xmlDS.WriteXml(writer);
int count = (int)stream.Length;
byte[] arr = new byte[count];
stream.Seek(0, SeekOrigin.Begin);
stream.Read(arr, 0, count);
UTF8Encoding utf = new UTF8Encoding();
return utf.GetString(arr).Trim();
}
catch
{
return String.Empty;
}
finally
{
if (writer != null) writer.Close();
}
}
private DataSet ConvertXMLToDataSet(string xmlData)
{
StringReader stream = null;
XmlTextReader reader = null;
try
{
DataSet xmlDS = new DataSet();
stream = new StringReader(xmlData);
reader = new XmlTextReader(stream);
xmlDS.ReadXml(reader);
return xmlDS;
}
catch (Exception ex)
{
string strTest = ex.Message;
return null;
}
finally
{
if (reader != null)
reader.Close();
}
}


Ïà¹ØÎĵµ£º

xmlÓëDataSetµÄ»¥×ª»»Àà

ÒÔǰÔÚ²©¿ÍÉÏ·¢¹ý£¬¾­ÈËÌáÐÑ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 תdataset

///ͨ¹ý´«ÈëµÄÌØ¶¨XML×Ö·û´®£¬Í¨¹ý ReadXmlº¯Êý¶ÁÈ¡µ½DataSetÖС£
protected static DataSet GetDataSetByXml(string xmlData)
{
           try
           {
       &nbs ......

XML½ÚµãÐÅÏ¢»ñÈ¡ XpathÓ¦ÓÃʾÀý

ÒªÖªµÀ´Ó¸ù½ÚµãÒ»Ö±ÏÂÀ´µÄÏà¶Ô·¾¶²ÅÄÜÈ·¶¨XpathµÄд·¨¡£
/root/<½Úµã1>/<½Úµã2>//<@ÊôÐÔ>
XpathÊǹ¦ÄܺÜÇ¿´óµÄ£¬µ«ÊÇÒ²ÊÇÏà¶Ô±È½Ï¸´ÔÓµÄÒ»Ãż¼Êõ£¬×îºÃ»¹Êǵ½²©¿ÍÔ°ÉÏÃæÈ¥×¨ÃÅÕÒһЩרҵµÄÌû×ÓÀ´¿´Ò»¿´£¬ÏÂÃæÊÇһЩ¼òµ¥µÄXpathÓï·¨ºÍÒ»¸öʵÀý£¬Ìṩ¸øÄã²Î¿¼Ò»ÏÂ
<?xml version="1.0" encoding="IS ......

XML ÈëÃűضÁ

1£®Ê²Ã´ÊÇXML£¿
XML ¿ª·¢ÕßÃÇ»á¸æËßÄ㣬ÊÂʵÉÏXML²¢²»ÊÇÒ»ÖÖÓïÑÔ£¬¶øÊÇÒ»ÖÖÓÃÀ´¶¨ÒåÆäËüÓïÑÔµÄϵͳ¡£¿ÉÄÜÄãÒѾ­Ìý¹ý£¬»òÐíÉõÖÁ×Ô¼º³¢ÊÔ¹ýһЩÕâÑùµÄÓïÑÔ??±ÈÈç΢ÈíÎªÍÆ£¨push£©¼¼ÊõËùÍÆ³öµÄƵµÀ¶¨Òå¸ñʽ£¨Channel Definition Format£©¡£
W3CÊÇ»¥Á¬ÍøÉÏһЩ¹«Óñê×¼µÄ¿ª·¢Õߣ¬ËûÍÆ³öÁËһϵÁкÍXMLÏà¹ØµÄ±ê× ......

ÔÚXMLÀïдSQLÓï¾ä£¨°ÑSQLÓï¾äд½øXMLÀ

ÄãÖªµÀXMLÎļþ°É£¿£¨²»ÖªµÀµÄGOOGLEÈ¥£¡£©ÄÇÄãÌý˵¹ýÔÚXMLÀïÊéдSQLÓï¾äÂ𣿻»¾ä»°Ëµ£¬°ÑÄãµÄÏîÄ¿ÀïËùÓÐSQLÓï¾ä´æ´¢ÔÚXMLÎļþÀÄãÌý˵¹ýÂð£¿Äã×ö¹ýÂð£¿
ÎÒÍ·´ÎÌý˵ÊÇС°¬¸æËßÎҵģ¬ÎҸҿ϶¨ËûÊǸöÕâ·½ÃæµÄ¸ßÊÖ£¬ºÇºÇ£¨ÔÞÒ»¸ö£¬µ½´ËΪֹ£¡£©
ÄǸøÄãչʾһÏ£¬ÔÚXMLÀïÊéдSQLÓï¾ä°É
<commands>
  <comman ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ