XML Problem

philprice

Well-known member
Joined
Mar 21, 2003
Messages
116
Location
Hull, UK
Code:
    Private Sub Process_Info_Node(ByRef feed As RSSFeed, ByVal XMLNav As XPathNavigator)
        Dim XMLInfo As XPathNodeIterator
        XMLInfo = XMLNav.SelectChildren(XPathNodeType.Element, True)
        XMLInfo.Current.MoveToFirstChild()  Move into channel
        Do
            If (CStr(XMLInfo.Current.Name).ToUpper = "TITLE") Then
                feed.siteTitle = CStr(XMLInfo.Current.Value)
            End If

            If (CStr(XMLInfo.Current.Name).ToUpper = "LINK") Then
                feed.siteLink = CStr(XMLInfo.Current.Value)
            End If

        Loop While (XMLInfo.MoveNext())
    End Sub

This takes a XPathInterator set to the node "channel", moves into the child nodes, there there are nodes called "title", "link", "description" etc, but my method only finds title nodes, any idea why? If i print out each node it finds its just title...
 
Code:
  <?xml version="1.0" encoding="utf-8" ?> 
- <rss version="3.14159265359" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
- <channel>
  <title>dive into mark</title> 
  <link>[url]http://diveintomark.org/[/url]</link> 
  <description>A lot of effort went into making this effortless.</description> 
  <dc:language>en</dc:language> 
  <dc:creator>Mark Pilgrim (f8dy@diveintomark.org)</dc:creator> 
  <dc:rights>Copyright 2003 Mark Pilgrim</dc:rights> 
  <dc:date>2003-03-22T23:24:27-05:00</dc:date> 
  <admin:generatorAgent rdf:resource="http://www.movabletype.org/?v=2.62" /> 
  <admin:errorReportsTo rdf:resource="mailto:f8dy@diveintomark.org" /> 
  <sy:updatePeriod>daily</sy:updatePeriod> 
  <sy:updateFrequency>8</sy:updateFrequency> 
  <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> 
- <item>
  <title>Redesign</title> 
  <link>[url]http://diveintomark.org/archives/2003/03/22/redesign.html[/url]</link> 
  <description>In progress. Discuss. (3 words)</description> 
  <guid isPermaLink="false">2222@[url]http://diveintomark.org/[/url]</guid> 
  <comments>[url]http://diveintomark.org/archives/2003/03/22/redesign.html#comments[/url]</comments> 
- <content:encoded>
- <![CDATA[ In progress.  Discuss.
  ]]> 
  </content:encoded>
  <dc:subject /> 
  <dc:date>2003-03-22T23:24:27-05:00</dc:date> 
  </item>
   
  .....
 
Hm, looks pretty fine to me, too.

I cant see where the behaviour is caused.

Id retry it with step through debugging and thoroughly examining the variables (XMLInfo in this case). If you already did that ... :( ...
 
Found the problem, an odd one..

Loop While (XMLInfo.MoveNext())

needs to be

Loop While (XMLInfo.Current.MoveNext())

odd..
 
Back
Top