Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > RSS and Atom
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
RSS and Atom Ask questions, get answers, discuss creating RSS and Atom feeds or programming apps or sites that create or consume RSS/Atom. Please leave any RSS/Atom politics out of this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the RSS and Atom section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 17th, 2005, 10:02 PM
Registered User
 
Join Date: May 2005
Location: newark, new jersey, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to hsascubaboy Send a message via MSN to hsascubaboy
Default code for rss work

Hi,
I'm new to programming in vb6 and i am trying to download, parse and save an RSS(XML) file. I am using the wrox XML and VB6 book and it has been a big help so far. I've written most of the code and it works except for 1 thing; I don't get any data from the child nodes, the only data I get is from the parent node.Here is the code:

Private Sub Form_Load()
    getFile

End Sub
Public Sub getFile()

    Dim objDom As MSXML2.DOMDocument
    Set objDom = New MSXML2.DOMDocument
    objDom.async = False
    objDom.Load "http://www.nytimes.com/services/xml/rss/nyt/International.xml"
    objDom.save "c:/test4.xml"
    Dim objElement As IXMLDOMElement
    Dim objNodeList As IXMLDOMNodeList
    Dim sTemp As String
    Dim nIdx As Integer
    Dim sXML As String
    Dim fsoSave As Scripting.FileSystemObject
    Dim tSave As Scripting.TextStream


    With objDom

        sTemp = ""
        Set objElement = .getElementsByTagName("description").Item(0)
        For nIdx = 0 To objElement.childNodes.length - 1
            sTemp = sTemp & objElement.childNodes.Item(nIdx).nodeValue
        Next
        txtdescription = sTemp

        sTemp = ""
        Set objElement = .getElementsByTagName("title").Item(0)
        For nIdx = 0 To objElement.childNodes.length - 1
            sTemp = sTemp & objElement.childNodes.Item(nIdx).nodeValue
        Next
        txttitle = sTemp

    End With 'objDom

    sXML = ""
    sXML = "<np title=|The New York Times|>" & vbCrLf
    sXML = sXML & "<s name=|" & txttitle & "|>" & vbCrLf
    sXML = sXML & "<a hl=|" & txtdescription & "|" & vbCrLf

    Set fsoSave = New FileSystemObject
    Set tSave = fsoSave.OpenTextFile("c:/final.txt", ForWriting, True)
    tSave.Write (sXML)
    tSave.Close

End Sub

This is everything so far. I think the problem is in the With statement. Any help would be appreciated.

thanx
JV

  #2 (permalink)  
Old May 28th, 2005, 11:41 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Can you show a portion of the source XML? It's not a very elegant way of creating XML, writing text to a file, why not use the built in methods or XSLT?

--

Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old May 29th, 2005, 06:51 PM
Registered User
 
Join Date: May 2005
Location: newark, new jersey, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to hsascubaboy Send a message via MSN to hsascubaboy
Default

Joe,
I did some more reading and found XSLT was the way to go. Thanx for the reply.

John
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RSS Code for python 2.5 (pyxml Vs 4Suite) dsampson BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 1 February 12th, 2008 10:49 AM
Browser RSS feed auto detection code here madok BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 September 29th, 2006 09:04 AM
code clinic - Why wont example asp code work? jardbf Classic ASP Basics 3 April 27th, 2006 06:22 PM
code does not work keithschm Beginning PHP 5 January 10th, 2005 09:52 AM



All times are GMT -4. The time now is 07:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.