Issue with Getting XML value with multiple Namespaces in VBA.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I have a soap XML returned from Webservice an dtrying to get the values by looping through the each nodes.
is there a simplified way to get each values in VBA as an Object? i dont have any Stylesheet for this. Pls help on this. a sample code will be most helpful. Thanks in advance
below the sample XML : Data scrambled and i have removed "http://" infront of "schemas." from xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/ to avoid URL in this post
<?xml version="1.0" encoding="UTF-8"?><br/>
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/ <br/>
<soapenv:Body><br/>
<RetrieveResponse xmlns="urn:myCompany/interface/PC/BasePart/v1" xmlns:ns2="urn:myCompany/pd/bomf/Common/v1.0" xmlns:ns3="urn:myCompany/DS/Access/v1.0" xmlns:ns4="urn:myCompany/DS/Audit/v1.0" xmlns:ns5="urn:myCompany/EExtn/Attribute/v1.0"
xmlns:ns6="urn:myCompany/PC/BasePart/v1.0" xmlns:ns7="urn:myCompany/PC/Transaction/v1.0" xmlns:ns8="urn:myCompany/PC/CrossReference/v1.0" xmlns:ns9="urn:myCompany/Program/PSR/v1.0" xmlns:ns10="urn:myCompany/PC/CPSC/v1.0" xmlns:ns11="urn:myCompany/ProductStructure/myCompanyxyzMapping/v1.0"
xmlns:ns12="urn:myCompany/PC/BaseConstituent/v1.0 <br/>
<OperationResult><br/>
<ns3:Successful>true</ns3:Successful><br/>
<ns3:Detail><br/>
<ns3:State>Successful</ns3:State><br/>
<ns3:Messages><br/>
<ns3:Message /><br/>
</ns3:Messages><br/>
</ns3:Detail><br/>
</OperationResult><br/>
<RetrieveResult sequence="1 <br/>
<Status><br/>
<ns3:State>Successful</ns3:State><br/>
<ns3:Messages><br/>
<ns3:Message><br/>
<ns3:ID>1011</ns3:ID><br/>
<ns3:Description>Starting from [3], returning elements 1 sdfsdff</ns3:Description><br/>
</ns3:Message><br/>
</ns3:Messages><br/>
</Status><br/>
<BasePart><br/>
<ns2:BasePartNumber>12345</ns2:BasePartNumber><br/>
<ns2:BasePartNumberVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:TrueBasePartNumber>12345</ns2:TrueBasePartNumber><br/>
<ns2:DesignNonDesignCode>Design</ns2:DesignNonDesignCode><br/>
<ns2:TrueBasePartDescription>FLR ASY COMP</ns2:TrueBasePartDescription><br/>
<ns2:BasePartTypeCode>3</ns2:BasePartTypeCode><br/>
<ns2:BasePartTypeDescription>Production-Body</ns2:BasePartTypeDescription><br/>
</ns2:BasePartNumberVersion><br/>
<ns6:BasePartNumberPartAddressFunctionMap><br/>
<ns6:Version>1</ns6:Version><br/>
<ns6:VersionStatus>P</ns6:VersionStatus><br/>
<ns6:TrueBasePartStatusCode>NO</ns6:TrueBasePartStatusCode><br/>
<ns6:TrueBasePartSequenceNumber>SEQ# 000</ns6:TrueBasePartSequenceNumber><br/>
<ns6:PartAddressFunction><br/>
<ns2:Code>8FCCB</ns2:Code><br/>
<ns8:PartAddressFunctionVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:Description>Front Floor Complete Assembly</ns2:Description><br/>
<ns2:DesignNonDesignCode>D</ns2:DesignNonDesignCode><br/>
<ns2:DisplayOrder>1</ns2:DisplayOrder><br/>
<ns2:Comment>sdasd:11/18/2009 02:11:19 PM</ns2:Comment><br/>
<ns2:ExtendedAttribute><br/>
<ns5:Name>Production Tooling Lead Time (Weeks)</ns5:Name><br/>
<ns5:Value><br/>
<ns5:Float>34.0</ns5:Float><br/>
<ns5:Sequence>1</ns5:Sequence><br/>
</ns5:Value><br/>
</ns2:ExtendedAttribute><br/>
</ns8:PartAddressFunctionVersion><br/>
<ns12:PartAddressFunctionCPSCMap><br/>
<ns12:Version>1</ns12:Version><br/>
<ns12:VersionStatus>P</ns12:VersionStatus><br/>
<ns12:Cpsc><br/>
<ns2:Code>010101</ns2:Code><br/>
<ns12:CpscVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:Name>Front Floor</ns2:Name><br/>
<ns2:Description>fdgfdgfdg.</ns2:Description><br/>
<ns2:ForUseOf>Prts &amp; Deliv. Release (Vhcl)</ns2:ForUseOf><br/>
<ns2:GpdsProgramScale>UN</ns2:GpdsProgramScale><br/>
<ns2:UPUNPTCode>UN</ns2:UPUNPTCode><br/>
<ns2:TeamCenterName>Front Floor</ns2:TeamCenterName><br/>
<ns2:CADOwner>Body CAD</ns2:CADOwner><br/>
<ns8:UpperBodyUnderBodyPTDesc>Underbody</ns8:UpperBodyUnderBodyPTDesc><br/>
</ns12:CpscVersion><br/>
<ns12:CPSCProgramModuleTeamCSSMap><br/>
<ns10:Version>1</ns10:Version><br/>
<ns10:VersionStatus>P</ns10:VersionStatus><br/>
<ns10:ProgramModuleTeam><br/>
<ns2:Code>122</ns2:Code><br/>
<ns2:Level>3</ns2:Level><br/>
<ns8:ProgramModuleTeamVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:Name>Underbody</ns2:Name><br/>
<ns2:Comment>COMMENT_X1</ns2:Comment><br/>
<ns2:PMTLevel1><br/>
<ns2:Code>100</ns2:Code><br/>
<ns2:Level>1</ns2:Level><br/>
<ns8:ProgramModuleTeamVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:Name>Body
Exterior</ns2:Name><br/>
<ns2:Comment>COMMENT_X1</ns2:Comment><br/>
</ns8:ProgramModuleTeamVersion><br/>
</ns2:PMTLevel1><br/>
</ns8:ProgramModuleTeamVersion><br/>
</ns10:ProgramModuleTeam><br/>
<ns10:Css><br/>
<ns2:Code>31</ns2:Code><br/>
<ns10:CssVersion><br/>
<ns2:Version>1</ns2:Version><br/>
<ns2:VersionStatus>P</ns2:VersionStatus><br/>
<ns2:Name>Lower Body Structure</ns2:Name><br/>
<ns2:CFEActivity>Body Exterior</ns2:CFEActivity><br/>
</ns10:CssVersion><br/>
</ns10:Css><br/>
</ns12:CPSCProgramModuleTeamCSSMap><br/>
</ns12:Cpsc><br/>
</ns12:PartAddressFunctionCPSCMap><br/>
</ns6:PartAddressFunction><br/>
<ns6:PartAddressFunctionBasePartUID>ZDTDL</ns6:PartAddressFunctionBasePartUID><br/>
</ns6:BasePartNumberPartAddressFunctionMap><br/>
</BasePart><br/>
</RetrieveResult><br/>
<EndOfSequence>true</EndOfSequence><br/>
</RetrieveResponse><br/>
</soapenv:Body><br/>
</soapenv:Envelope>


View the full article
 
Back
Top