Importing XML into a RecordSet
page 2 of 2
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 35017/ 72

Looking at the RecordSet

Looking at the RecordSet

You can navigate this recordset like any other -

Do While Not objRS.EOF
Response.Write(objRS.Fields(0) & "<br>")
objRS.MoveNext
Loop

Live Demo

This code will only print out the <Headline> Tag. This is because the recordset is organized like this -

<table border="1" width="100%">
<%
Response.Write("<tr>")
For Each fld in objRS.Fields
If fld.Name <> "$Text" Then
Response.Write("<td>" & fld.Name & "</td>")
End If
Next
Response.Write("</tr>")
Do While Not objRS.EOF
Response.Write("<tr>")
For Each fld in objRS.Fields
If fld.Name <> "$Text" Then
Response.Write("<td>" & fld.Value & "</td>")
End If
Next
Response.Write("</tr>")
objRS.MoveNext
Loop
%>
</table>

Live Demo

We ignore the $Text column because it is the entire record in one field so it doesn't look very nice.

Now you can navigate the XML file as if it was a regular recordset.

Summary

With this solution, you'll find it much easier to navigate XML files that can be tedious task using the XMLDOM.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-11-17 11:10:43 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search