ͨ¹ýLINQ to XMLÉú³É XML
±êÇ©£ºÊý¾Ý·ÃÎÊ ADO.NET
ͨ¹ýLINQ to XMLÉú³É XML XML³£³£ÓÃÓïÔÚ¿Í»§»úºÍ·þÎñÆ÷Ö®¼ä½»Á÷Êý¾Ý£¬»òÕ߶à²ãÓ¦ÓóÌÐòÖ®¼ä½»Á÷¡£
ÓÃLINQ to SQL²éѯÊý¾Ý£¬ÔÙÓÃLINQ to XML°ÉÊý¾Ýת»»ÎªXML.
Àý£º
.......
AreslabDataContext aresData = new aresData(); //´´½¨DataContextʵÀý
XElement aresCustomerOrders = new XElement("customers", //´´½¨XMLƬ¶ÎʵÀý from c in aresData.Customers //ÀûÓÃLINQ²éѯÊý¾Ý£¬DataContext¶ÔÏóµÄCustomers³ÉÔ±×÷ΪÊý¾ÝÔ´ select new XElement("customer", //¹¹½¨selectͶÉä new XAtrribute("ID", c.CustomerID), new XAtrribute("Company", c.CompanyName),
Ïà¹ØÎĵµ£º
IsolatedStorageFile£º°üº¬ÎļþºÍÊý¾ÝµÄ¶ÀÁ¢´æ´¢Çø
datasetÊý¾Ý´æ´¢µ½±¾µØxmlÎĵµ£¬´úÂë´¦ÀíÈçÏÂ
public static void WriteDataToXML(DataSet dataset, string dataname)
{
try
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly(); / ......
from£ºhttp://www.xland.com.cn/article/7/81/0804/28778.htm
±¾ÀàʵÏÖ£º
Êý¾Ý¿âÐÅÏ¢µ¼³ö£ºword£¬excel£¬json£¬xml£¬sql
Êý¾Ý¿â»Ö¸´£º´Ósql£¬´ÓÎļþ
¾ßÌåÓ÷¨:
Ê×ÏÈн¨²âÊÔÓÃÊý¾Ý¿âmytest£¬È»ºóÔÚÀïÃ潨Õűí
PHP´úÂë:
ÒÔÏÂÊÇ´úÂëƬ¶Î£º
--
-- ±íµÄ½á¹¹ `test`
--
CREATE TABLE `test` (
`id ......
var
xmlDoc
=
null
;
function
parseXML
(
xmlUrl
)
{
¡¡¡¡try
{
¡¡¡¡¡¡¡¡//IE
¡¡¡¡¡¡¡¡xmlDoc
=
new
ActiveXObject
(
"Microsoft.XMLDOM"
);
¡¡¡¡¡¡¡¡xmlDoc
.
async
=
false
;
¡¡¡¡¡¡¡¡xmlDoc
......
XMLÎļþʵÀý£º
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Resource auth="Container" maxActive="20" name="sss" password="123"
type="javax.sql.DataSource" />
<Resource auth="Container" ......
×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.
Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.
Attribute, Ö¸ÔÚ<Employee >ÖеĴ ......