Results 1 to 2 of 2

 

Thread: Using XML option for descriptions at OMGUK

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Nov 2003
    Location
    Market Rasen, Lincolnshire.
    Posts
    263
    Thanks
    3
    Thanked 1 Time in 1 Post


    Hi Guys

    I have tried, without success, to use the XML option to display the editorials for current offers in OMGUK.

    Has anyone got any good tutorials I could learn from to display this type of feed please?

    I don't understand the layout of the data. I try to use Editorial as the item name but it doesn't give an error just blank page.

    Any guidence on this would be brilliant.

    Thanks
    Andy

    Make Gift Giving Personal and PersonaliseYaGifts | My New Blog about AffiliateLiving

  2. #2
    futureweb's Avatar
    Registered User

    Status
    Offline
    Join Date
    Jul 2005
    Location
    North Devon
    Posts
    919
    Thanks
    13
    Thanked 22 Times in 22 Posts
    Ok you need to remeber that the first node <TAGNAME></TAGNAME> will be 0 then 1,2,3 and so on so all you really need do is change the childnode numbers to suit in the "for each" section and the getElementsByTagName("YourTagName") see example XML here:



    <?xml version='1.0'?>
    <Products> <---------------------------- This is your TagName
    <Product ID="1" Name="Chai"
    Price="13"> <-------------------------- ChildNodes(0)
    <Desc Value="10 boxes x 20 Bags"/> <-------------- ChildNodes(1)
    </Product>
    <Product ID="2" Name="Chang"
    Price="10">
    <Desc Value="24 -12 oz bottles"/>
    </Product>
    <Product ID="3" Name="Tofu"
    Price="23.25">
    <Desc Value="40-100 kg pkgs"/>
    </Product>
    </Products>


    ########## CODE ################

    <%@ Language="VBScript" %>
    <% Option Explicit %>
    <% Response.Charset = "UTF-8" %>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>XML Reader</title>
    </head>
    <body>

    <%

    Dim objXML
    Dim objItemList
    Dim objItem
    Dim strHTML

    Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocumen t")
    objXML.async = False

    objXML.setProperty "ServerHTTPRequest", True
    objXML.Load("LINKTOXMLFILE")

    If objXML.parseError.errorCode <> 0 Then
    Response.Write "<pre>" & vbCrLf
    Response.Write "<strong>Error:</strong> " & objXML.parseError.reason
    Response.Write "<strong>Line:</strong> " & objXML.parseError.line & vbCrLf
    Response.Write "<strong>Text:</strong> " _
    & Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
    Response.Write "</pre>" & vbCrLf
    End If

    Set objItemList = objXML.getElementsByTagName("item")
    Set objXML = Nothing

    ' HERE'S WHERE YOU NEED TO LOOK
    '----------------------------------
    For Each objItem In objItemList
    strHTML = strHTML & "<p>" & vbCrLf
    strHTML = strHTML & "<a href=""" & objItem.childNodes(2).text & """>"
    strHTML = strHTML & "<strong><em>" & objItem.childNodes(0).text
    strHTML = strHTML & "</em></strong></a><br />" & vbCrLf
    strHTML = strHTML & objItem.childNodes(1).text & vbCrLf
    strHTML = strHTML & "</p>" & vbCrLf
    Next

    Set objItemList = Nothing

    Application.Lock
    Application("ShowXML") = strHTML
    Application("XMLDATE") = Now()
    Application.UnLock
    %>

    <%= Application("fishNewsContent") %>
    <!--<%= Application("XMLDATE") %>-->

    </body>
    </html>



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Where is the tracking code on this thehut.com search box please?
    By Azam.net in forum Commission Junction
    Replies: 3
    Last Post: 15-02-05, 10:58 PM
  2. XML Feeds - How do I use them?
    By DanielCoe in forum Programming
    Replies: 3
    Last Post: 25-11-04, 01:58 PM
  3. Anyone anygood with xml, php, mysql and Affiliate Window
    By AnnonnyMouse in forum Affiliate Marketing Lounge
    Replies: 1
    Last Post: 23-09-04, 11:00 AM
  4. Replies: 0
    Last Post: 12-08-04, 03:32 PM
  5. XML / XSL Help??????
    By uklejon in forum Programming
    Replies: 2
    Last Post: 31-03-04, 09:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2