Re: parsing xml



Oh, the error line was ...

For Each Att In Node.Attributes -Error Object required






--
hgeron


"Mark J. McGinty" wrote:


"hgeron" <hgeron@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D86CEFA0-08A6-4727-8ADC-D06632B3A911@xxxxxxxxxxxxxxxx
It halts before any msgbox at line in function marked "'ERROR- Object
Required...

Set NodeList = xmlDoc.childNodes

Should be Set NodeList = Node.childNodes



---------------------------------------------
Sub mark()
Dim xmlDoc As New MSXML2.DOMDocument50
Dim Node As IXMLDOMNode
Dim NodeList As IXMLDOMNodeList
xmlDoc.Load ("m:\xml\books.xml")
RecurseXML xmlDoc, 0
End Sub
Function RecurseXML(Node As IXMLDOMNode, Level As Long) As Boolean
Dim NodeList As IXMLDOMNodeList
Set NodeList = xmlDoc.childNodes 'ERROR- Object
Required
Dim Att As IXMLDOMAttribute
If NodeList.length = 0 Then
For Each Att In Node.Attributes
If MsgBox(Att.Value, vbOKCancel) = vbCancel Then Exit Function
Next
Else
For Each Node In NodeList
If MsgBox(Node.XML, vbOKCancel) = vbCancel Then Exit Function
If RecurseXML(Node, Level + 1) = False Then Exit Function
Next
End If
RecurseXML = True
End Function







--
hgeron


"Mark J. McGinty" wrote:


Sub Foo()
Dim xmlDoc As New MSXML2.DOMDocument50
xmlDoc.Load ("m:\xml\books.xml")


Oops that should be:

RecurseXML xmlDoc, 0

RecurseXML xmlDoc
End Eub






.



Relevant Pages

  • Re: parsing xml
    ... "Mark J. McGinty" wrote: ... The extra size is repeating nodes. ... Dim xmlDoc As New MSXML2.DOMDocument50 ... Function RecurseXML(Node As IXMLDOMNode, ...
    (microsoft.public.data.ado)
  • Re: parsing xml
    ... For Each Att In Node.Attributes -Error Object required ... = vbCancel Then Exit Function ... Dim xmlDoc As New MSXML2.DOMDocument50 ... Function RecurseXML(Node As IXMLDOMNode, ...
    (microsoft.public.data.ado)
  • Re: parsing xml
    ... "Mark J. McGinty" wrote: ... The extra size is repeating nodes. ... Dim xmlDoc As New MSXML2.DOMDocument50 ... Function RecurseXML(Node As IXMLDOMNode, ...
    (microsoft.public.data.ado)
  • Re: Using filename hyperlinks in Macros
    ... at that point you need to assure that the string att is a valid file ... is not going to look like a valid file name. ... Dim objOL As New Outlook.Application ... Set itm = doc.MailEnvelope.Item ...
    (microsoft.public.excel.programming)
  • Re: parsing xml
    ... Dim xmlDoc As New MSXML2.DOMDocument50 ... Function RecurseXML(Node As IXMLDOMNode, ... Dim Att As IXMLDOMAttribute ... RecurseXML xmlDoc.documentElement, 0 ...
    (microsoft.public.data.ado)