GET Attribute from XML

In the xml below, how to get the data inside the attribute, I’ve tried many ways and I’m not succeeding

test.xml (9.8 KB)


Please check this follow the steps


Using the mentioned tutorial, I couldn’t find the CNPJ value in the XML, when I try to specify the element, the result is always Null


Kindly note: the provided XML was incomplete we did repair for some prototyping

CNPJ is an element

we dont know the details, what was done

as discussed: it was checked and setup the default Namespace:

And when fetching the CNPJ elements the namespace is used:

So we would recommend to incorporate the namespace handling as well in your modelling

Thank you very much, in this case I need to get the second number, but when I put it in a for each it brings me a whole string:04895728000180

How do I get just the numbers without using regex, how?

we would loop over the descendants return
xDoc.root.Descendants(xnsDefault + "CNPJ").
Access directly the second one
catch all values

Find some samples:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.