JavaScript to read remote XML
<Script language = "JavaScript">
VaR xmldoc = new activexobject ("Microsoft. xmldom ");
Xmldoc. async = false;
Xmldoc. Load ("http://www.donews.com/rss.xml ");
// Xmldoc. loadxml ("<description> character </description> ");
VaR root=xmldoc.doc umentelement;
VaR number = root. selectnodes ("channel/item"). length;
If (number <= 10)
Alert ("sorry, the number of news lines is already less than the number of news lines to be displayed! ");
Else
{
Document. writeln ("<p align = 'center' class = 'font'>" + root. childnodes (0 ). childnodes (0 ). text + "<p> ");
Document. writeln ("<P class = 'indent '>" + root. childnodes (0). childnodes (1). Text + "</P> ");
Document. writeln ("<P class = 'indent '>" + root. childnodes (0). childnodes (2). Text + "</P> ");
For (VAR I = 0; I <10; I ++)
{
Document. writeln ("<B>" + root. childnodes (0 ). childnodes (5 + I ). childnodes (0 ). text + "</B> <br/> ");
Document. writeln ("<small>" + root. childnodes (0 ). childnodes (5 + I ). childnodes (4 ). text + "& nbsp;" + root. childnodes (0 ). childnodes (5 + I ). childnodes (3 ). text + "</small> <br/> ");
Document. writeln ("<small> <a href = '" + root. childnodes (0 ). childnodes (5 + I ). childnodes (1 ). text + "'>" + root. childnodes (0 ). childnodes (5 + I ). childnodes (1 ). text + "</a> </small> <br/> ");
Document. writeln ("<P class = 'indent '>" + root. selectnodes ("channel/item/description") (I ). text + "</P> <br/> ");
}
}
</SCRIPT>
Implement ASP to read remote XML files
<%
Dim xmldoc
Dim Root
Dim number
Set HTTP = server. Createobject ("Microsoft. XMLHTTP ")
HTTP. Open "get", "http://www.donews.com/rss.xml", false
HTTP. Send
Set xmldoc = server. Createobject ("Microsoft. xmldom ")
Xmldoc. async = false
Xmldoc. validateonparse = false
Xmldoc. Load (HTTP. responsexml)
Set root=xmldoc.doc umentelement
Number = root. selectnodes ("channel/item"). Length
If number <= 10 then
%>
<Script language = "vbscept">
Msgbox "sorry, the number of news lines is already less than the number of news lines to be displayed! "
</SCRIPT>
<%
Else
Response. Write "<p align = 'center' class = 'font'>" & root. childnodes (0). childnodes (0). Text & "<p>"
Response. Write "<P class = 'indent '>" & root. childnodes (0). childnodes (1). Text & "</P>"
Response. Write "<P class = 'indent '>" & root. childnodes (0). childnodes (2). Text & "</P>"
For I = 0 to 9
Response. write "<B>" & root. childnodes (0 ). childnodes (5 + I ). childnodes (0 ). text & "</B> <br/>"
Response. write "<small>" & root. childnodes (0 ). childnodes (5 + I ). childnodes (4 ). text & root. childnodes (0 ). childnodes (5 + I ). childnodes (3 ). text & "</small> <br/>"
Response. write "<small> <a href = '" & root. childnodes (0 ). childnodes (5 + I ). childnodes (1 ). text & "'>" & root. childnodes (0 ). childnodes (5 + I ). childnodes (1 ). text & "</a> </small> <br/>"
Response. write "<P class = 'indent '>" & root. selectnodes ("channel/item/description") (I ). text & "</P> <br/>"
Next
End if
%>