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)
@KMota
While I was working on your issue, you solved by yourself. Great
xpath: âstring(//*[local-name()=ânNFâ]/text()[1])â 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