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

XMLHttpRequest Òì²½´¦ÀíXMLµäÐÍÓ¦ÓÃ

ÉùÃ÷¶ÔÏóʵÀý
var xmlhttp = false;
//²úÉúÒ»¸öXMLHttpRequest¶ÔÏóʵÀý
getHTTPRequestObject();
function getHTTPRequestObject()
{
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E)
{
xmlhttp = false;
}
}
if(!xmlhttp && typeof XMLHttpRequest!= 'undefined')
{
xmlhttp = new XMLHttpRequest();
}
}
//»Øµ÷´¦Àí
function callback()
{
if(xmlhttp.readyState == 4)
{
if(xmlhttp.status == 200)
{
var xmlresponse = xmlhttp.responseXML.documentElement; //»ñÈ¡xml²Ù×÷¶ÔÏó
document.getElementById("divResponse").innerText = xmlhttp.responseText; //È«ÎÄÒýÓÃ

alert(xmlresponse.getElementsByTagName("message")[0].firstChild.data);//½ÚµãÊý¾ÝÒýÓÃ
}
}
}
//´¥·¢Ê¼þ
function btnClick()
{
xmlhttp.open("GET", "XMLFile.xml", true);
xmlhttp.onreadystatechange = callback;
xmlhttp.send(null);
}
XMLFile.xmlÎļþÄÚÈÝ£º
<?xml version="1.0" encoding="utf-8" ?>
<messages>
<message>
Hello!
</message>
</messages>


Ïà¹ØÎĵµ£º

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, E ......

JSPÖÐʹÓÃXMLʵÏÖµ¯³öʽ²Ëµ¥

Ó¦ÓÃJSP£¬XMLºÍCSS¼¼ÊõʵÏÖµ¯³öʽ²Ëµ¥µÄ¹¤³Ì¿ò¼Ü¡£
  ×ۺϲÉÓÃJSP£¬JavaBean£¬XML£¬XSL£¬CSS£¬JavaScript¶àÏî¼¼ÊõµÄÓŵ㡣
  ÔÚJSPÖÐʹÓÃXMLÎĵµ£¬XML¶¨ÒåÊý¾Ý¸ñʽ£¬ÔÚJSPÖÐÖ±½ÓÉú³ÉXMLÎļþ£¬ËüÓëJavaBean½»»¥£¬JavaBean¸ºÔð¶ÁÈ¡´æ´¢²Ëµ¥ÏîµÄÎļþ¡£
XSLʵÏÖXMLµ½HTMLµÄת»¯£¬CSSÎļþ¸ºÔðÑùʽµ¥µÄ¶¨Ò壬¶øJavaS ......

´«ÖDz¥¿Í—XML»ù´¡£¨Ï£©

½ñÌì¼ÌÐø½²XML£¬ÕùÈ¡ÔÚÏÂÎç5µãǰռÁìXML¸ßµØ¡£Ò»¹²Èý¸öÖ÷ÒªÄÚÈÝ£ºSAX½âÎö¼¼Êõ£¬DOM4JºÍSCHEMA¡£
Ê×ÏÈÊÇSAX½âÎö¼¼Êõ£ºSAX²ÉÓÃʼþ´¦ÀíµÄ·½Ê½½âÎöXMLÎļþ¡£ÀûÓà SAX ½âÎö XML Îĵµ£¬Éæ¼°Á½¸ö²¿·Ö£º½âÎöÆ÷ºÍʼþ´¦ÀíÆ÷¡£
½âÎöÆ÷¸ºÔð¶ÁÈ¡ XML Îĵµ£¬²¢Ïòʼþ´¦ÀíÆ÷·¢ËÍʼþ
ʼþ´¦ÀíÆ÷¸ºÔð¶Ôʼþ×ö³öÏàÓ¦£¬¶Ô´«µÝµÄ XML Êý¾Ý ......

XmlÖÐSelectSingleNode·½·¨ÖеÄxpathÓ÷¨

×î³£¼ûµÄXMLÊý¾ÝÀàÐÍÓУºElement, Attribute£¬Comment, Text.  
 
   Element, Ö¸ÐÎÈç<Name>Tom<Name>µÄ½Úµã¡£Ëü¿ÉÒÔ°üÀ¨£ºElement, Text, Comment, ProcessingInstruction, CDATA, and EntityReference.  
 
   Attribute, Ö¸ÔÚ<Employee >Ö ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ