Results 1 to 18 of 18

Thread: help with XML

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    116

    Re: help with XML

    sure here you go, this is the XML file where the AUTOFLAG typed value is "1"
    Attached Files Attached Files

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    116

    Re: help with XML

    hmm, its actually an object required error now

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    116

    Re: help with XML

    have you had any ideas on this? sorry to keep asking

  4. #4

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    116

    Re: help with XML

    well, as this is a COm addin for outlook I cannot really debug, however using message boxes it gets to this line:

    VB Code:
    1. Set NextNode = Nodes.NextNode.selectSingleNode("REASON").nodeTypedValue


    and an object required error occours

  6. #6

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    116

    Re: help with XML

    ok this is the actual line:


    Set NextNode = nodes.NextNode.selectSingleNode("AUTOFLAG").nodeTypedValue

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: help with XML

    The NodeList you are creating is already a list of AUTOFLAG nodes so you don't need to go any deeper. That simplifies it a bit. I also changed "nodes" since that's a reerved word.

    VB Code:
    1. Dim xmlDocIssueNumber As DOMDocument
    2.     Dim NextNode As IXMLDOMNode
    3.     Set xmlDocIssueNumber = New DOMDocument
    4.     xmlDocIssueNumber.preserveWhiteSpace = True
    5.     xmlDocIssueNumber.Load "C:\vb examples\xml\test.xml"
    6.     Dim oXMLNodes As IXMLDOMNodeList
    7. '    xmlDocIssueNumber.loadXML (cIssueNoXML)
    8. '    xmlDocIssueNumber.save ("C:\Documents and Settings\Simon Pogrebinsky\Desktop\xmlSave\issueNo.xml")
    9.     Set oXMLNodes = xmlDocIssueNumber.selectNodes("//NewDataSet/AUTONUMBTABLE/AUTOFLAG")
    10. '    Dim i, strFaultFlag
    11. '    For i = 0 To oXMLNodes.length - 1
    12. '        Set NextNode = oXMLNodes.NextNode.selectSingleNode("AUTOFLAG").nodeTypedValue
    13. '            If Not (NextNode Is Nothing) Then
    14. '                If oXMLNodes.NextNode.selectSingleNode("AUTOFLAG").nodeTypedValue = "1" Then
    15. '                    strFaultFlag = "1"
    16. '                Else
    17. '                    strFaultFlag = "0"
    18. '                End If
    19. '            End If
    20. '     Next
    21.  
    22.     Dim i, strFaultFlag
    23.     For i = 0 To oXMLNodes.length - 1
    24.         If oXMLNodes(i).nodeTypedValue = "1" Then
    25.             strFaultFlag = "1"
    26.         Else
    27.             strFaultFlag = "0"
    28.         End If
    29.         MsgBox strFaultFlag
    30.      Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width