![]() ![]() Set myList = oXMLFile.SelectNodes("/*/*/*") ' MOVE TO SECOND NESTED LEVELĭebug.Print myList(0).SelectSingleNode("*").Textĭebug.Print myList(1).SelectSingleNode("*").Textĭebug.Print myList(2).SelectSingleNode("*").Text Should you need to access indexed values, you can still use XPath for node or attribute value ' PRINT INDEXED NODE AND ATTRIBUTE ' PRINT ALL THIRD NESTED LEVEL ATTRIBUTES VALUES Set myList = oXMLFile.SelectNodes("/*/*/*") ' PRINT ALL THIRD NESTED LEVEL NODE VALUES tProperty "SelectionNamespaces", "xmlns:pdf=''" ![]() ' TEMPORARILY DEFINE PREFIX FOR DEFAULT NAMESPACE Below is a generalized version to walk down nested levels of tree: Set oXMLFile = CreateObject("MSXML2.DOMDocument") '''“Microsoft.XMLDOM”) To resolve, assign a colon-separated prefix like pdf to default namespace to access all nodes in its scope. Also, you have a default namespace, xmlns=".", in your XML document. Attributes, and other element collections. Set List = oXMLFile.SelectNodes("//fields/")Ĭonsider XPath, a more expressive parsing tool than walking down. Set oXMLFile = CreateObject("MSXML2.DOMDocument") '''“Microsoft.XMLDOM”) Set FD = Application.FileDialog(msoFileDialogOpen)įD.Filters.Add "PDF FORM DATA", "*.xfdf", 1 List -> Item(4) -> Attributes -> Item(1) -> valueĭim WApp As Object, WDoc As Object, WDR As Object List(4).Attributes(1).valueĪny tips on how to access the nested value? I have tried variations of the following but can't get it to work. In the below picture it is the expression/value highlighted in yellow. I am struggling on how to store the "Field Name". The goal is to get a "Field Name" and a "Value" for that field from the XML.Ĭurrently I am able to get the "Value" (Blue accent in picture below) by using a simple command such as: list(4).text pdf form (XFDF, XML) that I am importing into excel.
0 Comments
Leave a Reply. |