How should I write the for each string with the two namespaces in bold - NS1 and NS2 should be fine, but the “for each” gives an error becuase of the two namespaces.
For Each element As XElement In xmlDoc.Descendants(NS1 + “Envelope”).Elements(NS1 + “Body”).Elements(NS2 + “GetVehicleProductResult”).Elements(NS2 + “VFIInformation”)
’ Access elements within the loop, e.g., element.Element(NS2 + “BusinessUnitId”).Value
Next
Especially on anlysing the elements and its corresponding namespaces by using the …Descendants()(index) option within the immediate panel
here we would, depending on the analysis result, also construct a XNamespace variable and use it.
BTW: there are also techniques where we can grab all namespace variables dynamic and store it within a lookup dictionary. This LookUp Dictionary we use later for the retrieval
As 3 and 4 are the definitions of the namespace prefixes for “a” and “i”, respectively, we just use either of them if there is prefix a or i. (Probably we can ignore it when get GetVFListForVehicleProductResult element)
Can you share your xml and expected output as file, if possible? We might be able to write workflow.