ÓÃDOM´´½¨XMLÎĵµµÄÎÊÌâ - .NET¼¼Êõ / .NET¼¼ÊõÇ°Õ°
ÀûÓÃDOM´´½¨ÈçϽṹµÄXMLÎĵµ£¬ÎļþÃûΪstu_data.xml¡£Æä´óÖÂÎĵµ½á¹¹ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<ѧÉú×÷ÒµÁбí>
<ѧÉú id="001">
<ÐÕÃû>ÕÅÎÞ¼É</ÐÕÃû>
<ѧºÅ>2007213101</ѧºÅ>
<°à¼¶>ÐÅÏ¢¹ÜÀí°à</°à¼¶>
<¿Î³ÌÃû³Æ>XMLÓïÑÔ³ÌÐòÉè¼Æ</¿Î³ÌÃû³Æ>
<Åú´Î>6</Åú´Î>
<×÷ÒµÄÚÈÝ><![CDATA[data]]></×÷ÒµÄÚÈÝ>
</ѧÉú>
</ѧÉú×÷ÒµÁбí>
±»ÕâµÀÌâŪ·èÁË,¹òÇó¸÷λ¸ßÊÖ°ïæ,ÏÈллÁË
¸øÄã·¢¸öÀý×Ó£º
C# code:
<%
on error resume next
Dim SQL,RS
Set RS = Server.CreateObject("ADODB.RecordSet")
Set conn = server.createobject("adodb.connection")
OpenDBConn conn
SQL = "SELECT f1,f2,f3 from table1 WHERE f1=xx"
RS.Open SQL,Conn,1,1
RS.MoveFirst
Dim xmldoc
Set xmldoc = server.CreateObject("Msxml2.domdocument")
Dim version
Set version = xmldoc.createProcessingInstruction("xml","version='1.0' encoding='GB2312'")
xmldoc.appendchild
Ïà¹ØÎÊ´ð£º
´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽÎļþ
<folder state="unchecked" label="È«²¿">
¡¡¡¡<folder state="unchecked" isBra ......
<?xml version="1.0"?>
<root>
<status>433</status>
<msg>Õâ¸öÊǺº×Ö</msg>
<serialno>123</serialno>
</root>
ÈçºÎÓÃASP¶ÁÈ¡ statusÖµ ......
ÎÒÒªÔÚÍøÒ³ÉÏÉÏ´«Ò»¸öXMLÎļþ£¬ÎÒÔÚC#ÖÐдÁËÒ»¸öÑéÖ¤XMLÎļþ¸ñʽµÄ·½·¨£º
private bool ValidateXml(string xmlFilePath)
{
string xsdPath = Request.PhysicalApp ......
ÎÒÏÖÔÚÓÐÒ»¸öXML¶ÔÏó
var merxml
merxml ±£´æµÄÄÚÈÝ ÊÇ
<root>
<a>a</a>
<b>b</b>
</root>
ÎÒÏÖÔÚµÄÄ¿µÄÊÇÒª°Ñ merxml Õâ¸öXML¶ÔÏó ÍêÕûµÄÊä³öµ½Ò»¸öÎı¾¿ò tx ......
<UserModel xmlns="http://tempuri.org/">
<Name>Liu</Name>
<Age>23</Age>
</UserModel>
ÔõôÓÃlinq to xml ²éѯ°ÑÉÏÃæµÄÒ»¸ö×Ö·û´® ͶӰ³ÉÒ»¸ ......