Hello:
I am trying to parse an xml document using msxml. I am new to xml and I need help!!!
I want to loop through all the child nodes of the root node and create a text file for each "LogicalRecordType". Please show me how to iterate through the file. Thank you.
This is what I want to do:
<LogicalRecordType Type="A">
--
--
Loop and get everything in here
--
--
<\LogicalRecordType>
Move to next <LogicalRecordType Type="B">
Thank you.
<Purchase xmlns:xsi=" xsi:noNamespaceSchemaLocation="c:\chris\xml\xml\bin\Purchase.xsd">
- <LogicalRecordType Type="A">
<MicrofilmLocatorPrefix>200307</MicrofilmLocatorPrefix>
</LogicalRecordType>
- <LogicalRecordType Type="B">
<LogicalRecordCount>000000002</LogicalRecordCount>
<AuthorizedSalesAgentInstitutionId>00177</AuthorizedSalesAgentInstitutionId>
<AuthorizedSalesAgentBranchId>000006</AuthorizedSalesAgentBranchId>
<AuthorizedProcessingAgentInstitutionId>00177</AuthorizedProcessingAgentInstitutionId>
<AuthorizedProcessingAgentBranchId>000006</AuthorizedProcessingAgentBranchId>
<BulkEmployeeApplicationId xsi:nil="true" />
<DeliveryDestinationOfCertificates>23</DeliveryDestinationOfCertificates>
<PurchaseNumber>00000001</PurchaseNumber>
<PurchaseApplicationType>01</PurchaseApplicationType>
<--- more child nodes--->
</LogicalRecordType>
<----->more
Dim xmlDom As MSXML2.DOMDocument
Dim xmlNode As MSXML2.IXMLDOMNode
Dim xmlNodeList As MSXML2.IXMLDOMNodeList
Dim xmlNodeList2 As MSXML2.IXMLDOMNodeList
Dim xmlRoot As MSXML2.IXMLDOMElement
Dim xmlNode2 As MSXML2.IXMLDOMNode
Dim xmlNode3 As MSXML2.IXMLDOMNode
Dim xmlChildNodes As MSXML2.IXMLDOMNodeList
Dim xmlChildNode
Dim xmlChildNodeName
Set xmlDom = New MSXML2.DOMDocument
xmlDom.async = False
xmlDom.Load ("c:\chris\purchase.xml"
Set xmlRoot = xmlDom.documentElement
Set xmlChildNodes = xmlRoot.childNodes
'Set xmlChildNodes = xmlDom.documentElement.childNodes
Set xmlNodeList = xmlRoot.selectNodes("LogicalRecordType"
For Each xmlRoot In xmlNodeList
For Each xmlChildNodeName In xmlChildNodes
Debug.Print (xmlChildNodeName.nodeName)
Next xmlChildNodeName
Next xmlRoot
I am trying to parse an xml document using msxml. I am new to xml and I need help!!!
I want to loop through all the child nodes of the root node and create a text file for each "LogicalRecordType". Please show me how to iterate through the file. Thank you.
This is what I want to do:
<LogicalRecordType Type="A">
--
--
Loop and get everything in here
--
--
<\LogicalRecordType>
Move to next <LogicalRecordType Type="B">
Thank you.
<Purchase xmlns:xsi=" xsi:noNamespaceSchemaLocation="c:\chris\xml\xml\bin\Purchase.xsd">
- <LogicalRecordType Type="A">
<MicrofilmLocatorPrefix>200307</MicrofilmLocatorPrefix>
</LogicalRecordType>
- <LogicalRecordType Type="B">
<LogicalRecordCount>000000002</LogicalRecordCount>
<AuthorizedSalesAgentInstitutionId>00177</AuthorizedSalesAgentInstitutionId>
<AuthorizedSalesAgentBranchId>000006</AuthorizedSalesAgentBranchId>
<AuthorizedProcessingAgentInstitutionId>00177</AuthorizedProcessingAgentInstitutionId>
<AuthorizedProcessingAgentBranchId>000006</AuthorizedProcessingAgentBranchId>
<BulkEmployeeApplicationId xsi:nil="true" />
<DeliveryDestinationOfCertificates>23</DeliveryDestinationOfCertificates>
<PurchaseNumber>00000001</PurchaseNumber>
<PurchaseApplicationType>01</PurchaseApplicationType>
<--- more child nodes--->
</LogicalRecordType>
<----->more
Dim xmlDom As MSXML2.DOMDocument
Dim xmlNode As MSXML2.IXMLDOMNode
Dim xmlNodeList As MSXML2.IXMLDOMNodeList
Dim xmlNodeList2 As MSXML2.IXMLDOMNodeList
Dim xmlRoot As MSXML2.IXMLDOMElement
Dim xmlNode2 As MSXML2.IXMLDOMNode
Dim xmlNode3 As MSXML2.IXMLDOMNode
Dim xmlChildNodes As MSXML2.IXMLDOMNodeList
Dim xmlChildNode
Dim xmlChildNodeName
Set xmlDom = New MSXML2.DOMDocument
xmlDom.async = False
xmlDom.Load ("c:\chris\purchase.xml"
Set xmlRoot = xmlDom.documentElement
Set xmlChildNodes = xmlRoot.childNodes
'Set xmlChildNodes = xmlDom.documentElement.childNodes
Set xmlNodeList = xmlRoot.selectNodes("LogicalRecordType"
For Each xmlRoot In xmlNodeList
For Each xmlChildNodeName In xmlChildNodes
Debug.Print (xmlChildNodeName.nodeName)
Next xmlChildNodeName
Next xmlRoot