Last post Mar 09, 2011 06:01 AM by Martin_Honnen
Mar 08, 2011 12:09 PM|Schwimms|LINK
I have been racking my brain trying to make some MSXML code work with not much luck. I do have the majority of the code I just need a few parts.
The three things I need is:
1. I need to find the value in the page_count in the xml so I can loop my code.
2. I would like to insert a new childnode with the value of the array / Ar1. I found this
code but was unable to get it to insert the value of the Array.
3. There are several childnodes I do not want to come over from the data, specifically Total_items through search_time.. Here is the xml:
<title>Atlantic Bar & Grill Specials<title>
Here's my vb code:
Dim doc1 As MSXML2.DOMDocument30
Dim doc2 As MSXML2.DOMDocument30
Dim doc2Node As MSXML2.IXMLDOMNode
Dim xmlDocRoot As Object
Dim search As Object
Dim x As Integer
Dim arint As Integer
Dim Ar1 As Variant
Dim pageCount As Long
x = 1
pageCount = 1
Set doc1 = New MSXML2.DOMDocument30
Set doc2 = New MSXML2.DOMDocument30
doc2.async = False
'doc1 is an xml document that has the basic xml structure
doc1.Load "C:\Documents and Settings\schwimms\My Documents\Website\base.xml"
Ar1 = Array("food", "music")
For arint = 0 To 1
Do Until x = pageCount + 1
doc2.Load "http://api.eventful.com/rest/events/search?...&c=" & Ar1(arint) & "&t=future&location=Chicago&page_number=" & x & "&page_size=100&app_key=xxxxx"
For Each doc2Node In doc2.DocumentElement.ChildNodes
Set search = doc2.DocumentElement
'I get an object required error
Set PageCount = doc2.SelectSingleNode("//search/page_count")
x = x + 1
pageCount = 1
x = 1
Ar1(arint) = Ar1(arint + 1)
doc1.Save "C:\Documents and Settings\Schwimms\My Documents\Website\AllXMLBooks.xml"
Mar 09, 2011 06:01 AM|Martin_Honnen|LINK
Are you using ASP.NET? You shouldn't use MSXML at all in .NET applications, see
http://support.microsoft.com/kb/815112. The mangaged .NET classes in System.Xml should be used.