Import certain elements from XML into Access - InfoPath Dev
in

InfoPath Dev

Import certain elements from XML into Access

Last post 12-21-2006 11:32 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-19-2006 09:19 AM

    • davers
    • Not Ranked
    • Joined on 06-26-2006
    • USA
    • Posts 15

    Import certain elements from XML into Access

    Hi everyone. I'd like to import only certain XML elements from the InfoPath form into Access. I quite the newbie when it comes to InfoPath and XML...but here is what I have so far:


    Sub TestXML()

    Dim objDoc As MSXML2.DOMDocument40
    Dim objNode As MSXML2.IXMLDOMNode
    Dim nodeList As MSXML2.IXMLDOMNodeList

    Set objDoc = New MSXML2.DOMDocument40
    Set nodeList = objDoc.childNodes

    objDoc.Load xmlSource:="C:\Documents and Settings\dmorri18\Desktop\Form1.xml"

    For Each objNode In nodeList

    ' 1 = element and 7 = processing instruction
    If objNode.nodeType = 1 Then
    Debug.Print objNode.nodeTypedValue
    End If

    Next objNode

    End Sub


    The problem is it just prints the data in one long line. I'd like to only print out 3 of the 5 values. Does anyone know how to choose which ChildNodes I import?

    Thanks,

    Dave
  • 12-21-2006 11:32 PM In reply to

    Re: Import certain elements from XML into Access

    Hi Dave and welcome!
    I like your signature. :) We are pretty Noob with regards to Access. This seems like more of an XML traversal question an anything else. You'll need to select the node. There should be something like SelectSingleNode for VB. I forget but it's probably in my book on Developing Solutions with InfoPath. Sorry but the childnodes will traverse everything. You'll have to specify an xpath to filter the values.
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.