Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save to an xml file every 5mins and check for value

Posted on 2007-11-23
3
Medium Priority
?
189 Views
Last Modified: 2010-04-30
I have a url that seems to return me a XML file. I need to save it to a file so I can process it.

Then I need to check for a certain value for a element node every 5mins (quantity). Sometimes the node will be there, sometimes it will not. Is it possible to be done?
I need the item to be sold by amazon.com only not 3rd party merchants

http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1VZB58STNG3MCXSMS8G2&Operation=ItemLookup&ItemId=B000UA0LXQ&ResponseGroup=OfferFull&Version=2007-10-29&DeliveryMethod=Ship&Condition=New&IdType=ASIN
 
For some reason it returns -1

Open in new window

0
Comment
Question by:Sharalynn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 20340085
Using a timer...  I'm not sure it's necessary to save to a file, but I show how.  Also, how to extract a single node.
Imports System.Xml
Public Class Form1
 
   
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 300000 ' 5min
        Timer1.Enabled = True
    End Sub
 
    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim doc As New XmlDocument
        doc.Load("http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=1VZB58STNG3MCXSMS8G2&Operation=ItemLookup&ItemId=B000UA0LXQ&ResponseGroup=OfferFull&Version=2007-10-29&DeliveryMethod=Ship&Condition=New&IdType=ASIN")
        Dim nsMgr As New XmlNamespaceManager(doc.NameTable)
        nsMgr.AddNamespace("ns", "http://webservices.amazon.com/AWSECommerceService/2007-10-29")
        doc.Save("C:\items.xml")  'Save file?
 
        Dim node As XmlNode = doc.DocumentElement.SelectSingleNode("//ns:Amount", nsMgr)
        If Not node Is Nothing Then
            Debug.WriteLine(node.InnerText)
        End If
 
    End Sub
 
  
End Class

Open in new window

0
 

Author Comment

by:Sharalynn
ID: 20342246
This is almost perfect! Thank you! But you said that there is no need to save it to a file and I see why... it kind of auto save the stuff into a object already upon retrieving from the link. But still, useful, thank you.
0
 

Author Closing Comment

by:Sharalynn
ID: 31410674
save http link to xml file
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question