I am learning how to handle XML and I believe xpath will be the way to get the information you need. I can understand the syntax, but the value returned from xpath is always blank. can someone help me and check if there are any errors.
I searched other topics and learned how to deal with xpath, but I can’t understand why it doesn’t return me nNF that should be “10410”
I am unable to open your .XAML - it says “error detecting project version” when trying to open it.
I can see the XML though, what node are you trying to reach? Also, make sure you are dealing with the namespace properly, as that has caused me a lot of problems in the past (i still don’t really understand the point of namespaces, just seems to complicate everything)
While I was working on your issue, you solved by yourself. Great
xpath: “string(//*[local-name()=‘nNF’]/text())” would return the value.
Go on with the API that you currently used in your solution. I feel its easier to use on the start. And you are doing similiar, working with the local name.
And it was the issue with the namespaces.
A namespace let you allow to group elements in so called namespaces. In case you have more namespaces in use and e.g. some elements have the same name e.g. , you can identify those elements by using the namspace into account:
e.g. namspace1 has x: as an alias so element person is identified by x:person
Just in brief: <NFe xmlns="http://www.portalfiscal.inf.br/nfe"> Bold formatted part is defining the namespace, unfortenately with an alias. So option to direct adress nNF were gone.
About namespaces more in detail, come back on a seperate post and we help you.
thank you for your attention, your explanation was very clear. I’m walking, now I need to read a folder with multiple xml and extract the information, one by one and insert into another app. I’m trying if I can’t open another topic. thank you very much
I tested your xpath solution and it worked perfectly too