Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8143323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:05:35+00:00 2026-06-06T13:05:35+00:00

First off I would like to say that I think that my question may

  • 0

First off I would like to say that I think that my question may be time consuming for people to solve it in a complete sense so I understand that it is totally possible that the complete answer is asking for just way too much, so anything to help me better understand, like: reading material, examples, links, and/or advice would be great and I do very much appreciate any and every comment I receive, good or bad it just makes me and this place alot better, finally, I would like to thank you all so much for everything that you do here, this is truly a place that was build by smart people, and people that care.

MY QUESTION

(using Classic ASP and SQL Server)

I know that it is possible to read a remote XML file and then insert it into a SQL Server database table. I found one example that does that it uses Classic ASP and MS Access but that can be changed to SQL Server with minimal coding the URL is: http://forums.aspfree.com/code-bank-54/classic-asp-import-remote-xml-file-into-database-152966.html

But the problem is that I cannot get it to work on my remote XML file, I tried to edit the classic asp code (found in the link above) for days and days and I just cannot get it to work the way I would like.

So I want to start from the beginning,

The XML file in question is located on: http://www.iftach.org/taxmatrix/charts/2Q2012.xml

I seen a couple of examples on how you can export the entire xml file into the SQL Server database (like do a BULK insert, see URL: http://support.microsoft.com/kb/316005) and also on how to extract some info. from the XML but my request is kind of odd since I want to check for the Country first and then get that Counties Rate only and not the other one, I want to do this for the entire xml file.

For example the xml file is something like this:
(or you can view the full xml file by clicking on the URL above)

<FILE>
<QUARTER>2Q2012</QUARTER>
<RECORD>
<JURISDICTION ID="#15">AB</JURISDICTION>
<COUNTRY>CAN</COUNTRY>
......
......
<RATE RATECHANGE="0" COUNTRY="US">0.3366</RATE>
<RATE RATECHANGE="0" COUNTRY="CAN">0.0900</RATE>
......
......
......
</RECORD>

<RECORD>
<JURISDICTION ID="#15">FL</JURISDICTION>
<COUNTRY>U.S.</COUNTRY>
......
......
<RATE RATECHANGE="0" COUNTRY="US">1.5700</RATE>
<RATE RATECHANGE="0" COUNTRY="CAN">1.3210</RATE>
......
......
......
</RECORD>
</FILE>

and so on….

Now I would like to insert that info into the SQL Server table called FFTR and name the column specific for each JURISDICTION

Like for example the above would be:

Field Name 1 --> "JURISDICTION_AB_CAN"
Field Name 2 --> "JURISDICTION_FL_US"
and so on...

NOTE:
The prefix JURISDICTION_ will always be the same only the two letters will change and the CAN can become US.

Another thing is if the COUNTRY is “CAN” then I would like to use the CAN Rate and if it’s U.S. I would like to use the US Rate and insert that info. into the database with the Field named “RATE”. (The Rate will always be 4 decimal places) the Rate I want is only under: <FUEL_TYPE>Special Diesel</FUEL_TYPE> I don’t need the other Rates.

And the last thing I would like to do is to have the <QUARTER>2Q2012</QUARTER> inserted into a Field named “Quarter”

So the final SQL Server database would look like this (using the 2 records as an example above)

Field Name: JURISDICTION_AB_CAN
Rate: 0.0900
Quarter: 2Q2012

Field Name: JURISDICTION_FL_US
Rate: 1.5700
Quarter: 2Q2012

So what I tried to do is this (see code below) and I got it to show each line but it doesn’t even come close to a solution:

<% 
   Option Explicit 
   Response.Buffer = True 
   Dim xml 
   Set xml = Server.CreateObject("Microsoft.XMLDOM") 
   xml.async = False 
   xml.setProperty "ServerHTTPRequest", True 
   xml.Load ("http://www.iftach.org/TaxMatrix/charts/2Q2012.xml") 
   Dim paragraph1,paragraph2,paragraph3,paragraph4,paragraph5,paragraph6

   paragraph1 = xml.documentElement.childNodes(1).text
   paragraph2 = xml.documentElement.childNodes(2).text
   paragraph3 = xml.documentElement.childNodes(3).text
   paragraph4 = xml.documentElement.childNodes(4).text
   paragraph5 = xml.documentElement.childNodes(5).text
   paragraph6 = xml.documentElement.childNodes(6).text

   Set xml = Nothing 
%> 
<html> 
   <head> 
   <title></title> 
   </head> 
   <body> 
   <p align="center"><% = paragraph1 %></p>
   <p align="center"><% = paragraph2 %></p>
   <p align="center"><% = paragraph3 %></p>
   <p align="center"><% = paragraph4 %></p>
   <p align="center"><% = paragraph5 %></p>
   <p align="center"><% = paragraph6 %></p>
</body>
</html> 

I even think that adding it to a ADODB Recordset would be great and then I would insert it into SQL Server one by one or just loop it all in there, but it only shows me the columns I need the rows in there also. See code below:

<%
 Dim objRS
 Set objRS =  Server.CreateObject("ADODB.Recordset")
  objRS.ActiveConnection = "Provider=MSDAOSP; Data Source=MSXML2.DSOControl.3.0;"
  objRS.Open(Server.MapPath("2Q2012.xml"))


Response.Write(objRS.Fields(2) & "<br>") ' <-- Returns the Quarter only, that I need for the Quarter Field in the DB

'Response.Write(objRS.Fields(6) & "<br>") ' <-- Returns the entire xml page

Do While Not objRS.EOF

 objRS.MoveNext
 Loop


%>

<table border="1" width="100%">
 <%
 dim fld
 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>

Again, Thank you so much for any advice, links, or any help at all…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:05:36+00:00Added an answer on June 6, 2026 at 1:05 pm

    Finally!!! I made it work, if anyone needs the solution it is below:
    Using the code I posted in the question I added the following code:

    Note: I know that this is not the best way to do it since I’m not going after the TAGS/IDs/Names but the xml file will always stay formated the same so I just Looped, Cut out what I needed, and Inserted/Updated into the DB.

        <%
        ' LOOP ALL OF THE FIELDS ONE BY ONE
         For x = 0 to xml.documentelement.childnodes.length - 1
         set XMLobjchildnodes = xml.documentelement.childnodes
         strXMLtxt=xml.documentElement.childNodes(x).text & "<br>"
    
    
        ' SETUP THE UPDATE FIELDS FOR SQL
         dim strTest
         strTest="objSQL(""IMP_STATE_" & Mid(strXMLtxt,1,2) & """)=" & Mid(strXMLtxt,46,7)
    
        ' SKIP THE Fi and 2Q because they are not States/Prov.
        if strTest="objSQL(""IMP_STATE_Fi"")=" OR strTest="objSQL(""IMP_STATE_2Q"")=" then
        else
    
        ' ALSO SKIP hi and U and CN because they also are not States/Prov.
        if InStr(strTest,"STATE_ht")>0 OR InStr(strTest,"STATE_U.")>0 OR InStr(strTest,"STATE_CN")>0 then
        else
    
        ' ADD YOUR SQL CONNECTION INFO. HERE AND THEN INSERT/UPDATE THE SQL DB
    
    
        end if
    Next
        %>
    

    Note: By making small changes you can set it to Insert the data into SQL and/or update, should this be a problem for anyone please let me know I will be more then happy to help.

    To all that have tried to solve my problem/question, Thank you so much for all of your hard work and effort.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off I would like to say that this is my first post and
First off, I would like to say that I am very new to SharePoint
First off, before I ask, i would like to point out that this question
First off I would like to say that I have done ample research on
First off, I would like to say that I am just starting with PHP
First off I would like to say, that I am not trying to hack
First off, I would like to make clear, that I am SUPER NEW TO
The first thing i would like to say is that this is not exactly
First off, I think I'm trying to use Spring incorrectly, but confirmation would be
Hi first off I'd like to say I am new to the site and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.