Click to See Complete Forum and Search --> : problem comparing xml data in vb6


method
05-09-2007, 05:04 AM
I am trying to compare 2 xml files but i keep getting the following error:

Run-time error 453

object doesn't support this property or method

pointing at :
'compair files
If objDoc <> objDocCopy Then

could any one tell me what i am doing wrong here.thanks



Private Sub Form_Load()


'Set up the listview
ListView1.View = lvwReport
ListView1.ColumnHeaders.Add , , "Artist"
ListView1.ColumnHeaders.Add , , "Name"
ListView1.ColumnHeaders.Add , , "Image"
ListView1.ColumnHeaders.Add , , "Rating"
ListView1.ColumnHeaders.Add , , "Song ID"
ListView1.ColumnHeaders.Add , , "Total Votes"
ListView1.ColumnHeaders.Add , , "Page"
ListView1.ColumnHeaders.Add , , "Referrer"
ListView1.ColumnHeaders.Add , , "pageWindowName"
XMLCompair

'Timer1.Interval = 60000 ' <-- one minute
Timer1.Interval = 7000 ' <-- 10 seconds
Timer1.Enabled = True


End Sub


Private Sub XMLCompair()
Dim objDoc As MSXML2.DOMDocument
Dim objDocCopy As MSXML2.DOMDocument

'load the xml document
Set objDoc = New MSXML2.DOMDocument
objDoc.async = False
objDoc.Load "http://localhost/data.php"

'compair files
If objDoc <> objDocCopy Then
objDocCopy = objDoc
PopulateListview
End If
End Sub

Private Sub PopulateListview()
Dim objDoc As MSXML2.DOMDocument
Dim objNodelist As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim lvwItem As ListItem


'load the xml document
Set objDoc = New MSXML2.DOMDocument
objDoc.async = False
objDoc.Load "http://localhost/data.php"

'add all the song nodes into a nodelist
Set objNodelist = objDoc.selectNodes("//song")

'Clear the listview
ListView1.ListItems.Clear

'Loop through each song node and add to the list view
For Each objNode In objNodelist
Set lvwItem = ListView1.ListItems.Add(, , objNode.selectSingleNode("artist").Text)
lvwItem.SubItems(1) = objNode.selectSingleNode("name").Text
lvwItem.SubItems(2) = objNode.selectSingleNode("image").Text
lvwItem.SubItems(3) = objNode.selectSingleNode("rating").Text
lvwItem.SubItems(4) = objNode.selectSingleNode("songid").Text
lvwItem.SubItems(5) = objNode.selectSingleNode("totalvotes").Text
lvwItem.SubItems(6) = objNode.selectSingleNode("page").Text
lvwItem.SubItems(7) = objNode.selectSingleNode("referrer").Text
lvwItem.SubItems(8) = objNode.selectSingleNode("pageWindowName").Text
Next objNode

Set lvwItem = Nothing
Set objNodelist = Nothing
Set objDoc = Nothing
End Sub