I have the following xml:
<det nItem="1">
<prod>
<cProd>01554</cProd>
<xProd>La Aslan Velour 0001 </xProd>
<NCM>55111000</NCM>
<CFOP>5102</CFOP>
<uCom>UN</uCom>
<qCom>1.0000</qCom>
<vUnCom>6.90</vUnCom>
<indRegra>A</indRegra>
</prod>
<imposto>
<ICMS>
<ICMSSN102>
<Orig>0</Orig>
<CSOSN>102</CSOSN>
</ICMSSN102>
</ICMS>
</imposto>
</det>
I have a loop that validates my products, it checks the taxes and return an error if the tax is incorrect. If it happens that a product appears with the incorrect tax I need to know what it is, for that I use a counter in the loop, but how can I get the item data?
The items start with a <det nItem="1">
, what will change is the number that will indicate the item, but how can I point my counter to get the data that is within <det nItem="1">
?
Follow the code so far:
'Loop de todos os ICMS dos produtos
For Each ReadXML In document.Descendants("ICMS")
'Contador de produtos
Contador_Prod += 1
dim Prod = ReadXML.Descendants.Attributes(Contador_Prod)
Next
I thought I would have to use Attributes
, but it did not work very well.