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

DataTabת»»XML XMLת»»DataTable µÄÀà

public 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);
return System.Text.Encoding.GetEncoding("gb2312").GetString(arr).Trim();
}
catch
{
return String.Empty;
}
finally
{
if (writer != null) writer.Close();
}
}
public 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();
}
}


Ïà¹ØÎĵµ£º

glooxÖÐxmlµÄ½âÎö

·Ü¶·Á˽«½üÒ»¸öÔÂÒÆÖ²gloox¿âµ½brewƽ̨£¬ÔÚxml½âÎöµÄ×¼±¸Õâ±ß»¨Á˲»ÉÙʱ¼ä¡£ÆÚ¼äÒ²ÖØзâ×°Á˱ê×¼¿âµÄstring¡¢map¡¢listÀ࣬ÏÖÔÚ»ØÍ·ÏëÏëÊÕ»ñ»¹ÊÇÂù´óµÄ£¬µ«ÊÇòËÆÊÇÎÞÓõġ£
gloox´Ó0.9°æ±¾¿ªÊ¼¾Íno dependency on iksemel anymore£¬¶øiksemel×î³õÊÇרÃÅΪjabberдµÄxml½âÎöÆ÷£¬Õâô¿´À´£¬¶ÔÕâ¸öʱ¼ä·Ç³£½ôÆȵÄÏîÄ¿À´Ëµ£ ......

AJAXʹÓÃjson½âÎöÓëʹÓÃxml½âÎöµÄ±È½Ï

¹¤¾ß:myeclipse 6.5
jsonÖÐÎĹٷ½£ºhttp://www.json.org/json-zh.html
н¨ÏîÄ¿webs£¬ÔÚWebRootÏÂн¨Ä¿Â¼json
xmlµÄ½âÎö·½Ê½:
------------------------------------------------------------------
1.н¨NewFile.xml
<?xml version="1.0" encoding="UTF-8"?>
<userinfo>
  ......

¼ì²éxml´íÎó

°ÑxmlÍϵ½IEÀï¾ÍÕÒµ½´íÔÚÄÄÀïÁË
ÈçÏ£º
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
ÎĵµµÄ¶¥²ãÎÞЧ¡£´¦Àí×ÊÔ´ 'file:///D:/Tomcat 5.5/webapps/myapp/WEB-INF/web.xml' ʱ³ö´í¡£µÚ 1 ÐУ¬Î»ÖÃ: 44 ......

SQL XML DELETE

--A. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ±äÁ¿ÖеÄÎĵµÖÐɾ³ý½Úµã
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
 <!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
 Some text 1
 <st ......

XML XQuery

--XQuery »ùÓÚÏÖÓÐµÄ XPath ²éѯÓïÑÔ£¬²¢Ö§³Ö¸üºÃµÄµü´ú¡¢¸üºÃµÄÅÅÐò½á¹ûÒÔ¼°¹¹Ôì±ØÐèµÄ XML µÄ¹¦ÄÜ¡£
--1.ÉùÃ÷Ò»¸ö xml ÀàÐ͵ıäÁ¿£¬È»ºóʹÓà xml Êý¾ÝÀàÐ굀 query() ·½·¨À´²éѯ´Ë±äÁ¿
DECLARE @x xml
SET @x = '<ROOT><a>111</a></ROOT>'
SELECT @x.query('/ROOT/a')
--²éÕÒÊôÐÔaid=20µÄa½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ