Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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();
}
}


Ïà¹ØÎĵµ£º

VC++ÖвÙ×÷XML£¨MFC¡¢SDK£©

VC++ÖвÙ×÷XML£¨MFC¡¢SDK£©
2009Äê01ÔÂ07ÈÕ ÐÇÆÚÈý 22:33
XMLÔÚWin32³ÌÐò·½ÃæÓ¦¸ÃûÓÐÔÚWeb·½ÃæÓ¦Óõö࣬ºÜ¶à
Win32³ÌÐòÒ²Ö»ÊÇÓÃXMLÀ´´æ´æÅäÖÃÐÅÏ¢¶øÒÑ£¬¶øÇÒûÓÐ×ã¹»
µÄºÃ´¦µÄ»°»¹²»ÈçÓà ini¡£VC++Àï²Ù×÷XMLÓÐÁ½¸ö¿â¿ÉÒÔÓãº
MSXMLºÍXmlLite¡£MSXMLÓÖϸ·ÖÁËÁ½ÖÖ½Ó¿Ú£ºDOMºÍSAX2¡£XPû×Ô´øÓÐ XmlLite£¬Ö»×Ô´øÓÐ2.x¡¢3 ......

XML DTDÏà¹ØµÄÄÚÈÝ

Ò»¸ö¶¨ÒåEmailµÄÀý×Ó
<?xml version="1.0">
<!DOCTYPE message[
   <!ELEMENT message(header,body,signature,footer)>  --¶¨ÒåÁËmessageµÄ×ÓÔªËØ
   <!ELEMENT header(date,from,to,subject,banner)>    --header»¹ÓÐ×ÓÔªËØ
   <!ELEMENT ......

SQL Server2005µÄXMLÊý¾ÝÀàÐÍÖ®»ù´¡Æª2

value·½·¨
µ±Äã²»Ïë½âÊÍÕû¸ö²éѯµÄ½á¹û¶øÖ»ÏëµÃµ½Ò»¸ö±êÁ¿ÖµÊ±£¬Õâ¸övalue·½·¨ÊǺÜÓаïÖúµÄ¡£Õâ¸övalue·½·¨ÓÃÓÚ²éѯXML²¢ÇÒ·µ»ØÒ»¸öÔ­×ÓÖµ¡£
Õâ¸övalue·½·¨µÄÓï·¨ÈçÏ£º
value(XQuery£¬datatype)
½èÖúÓÚvalue·½·¨£¬Äã¿ÉÒÔ´ÓXMLÖеõ½µ¥¸ö±êÁ¿Öµ¡£Îª´Ë£¬Äã±ØÐëÖ¸¶¨XQueryÓï¾äºÍÄãÏëÒªËü·µ»ØµÄÊý¾ÝÀàÐÍ£¬²¢ÇÒÄã¿ÉÒÔ·µ»Ø³ ......

C#ÖÐÓÃXmlTextReader¶ÔÏó²Ù×÷XMLÎļþ

sd.xmlÎļþ:
<?xml version="1.0" encoding="gb2312"?>
<!--ÕâÊÇÒ»¸öxmlÎļþ-->
<xml1>
  <item name="1">µÚÒ»¸öitem</item>
  <item name="2">
      <item name="1">Õâ¸ö½áµã(1) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ