EDN Admin
Well-known member
Im trying to select an "Id" attribute from "infNFe" element... the XML looks like this:
<NFe xmlns="http://www.portalfiscal.inf.br/nfe <br/>
<infNFe Id="NFe31110207301671000131550010000010231123456780" versao="2.00
Heres the code:
<pre class="prettyprint var namespaceManager = new XmlNamespaceManager(new NameTable());
namespaceManager.AddNamespace("x", "http://www.portalfiscal.inf.br/nfe");
//selecting...
document.XPathSelectElement("//x:infNFe/@Id", namespaceManager).Value;[/code]
<br/>
But Im getting:
XPathSelectElement("//x:infNFe/@Id", namespaceManager) threw an exception of type System.InvalidOperationException <br/>
base {System.SystemException}: {"The XPath expression evaluated to unexpected type System.Xml.Linq.XAttribute."}
<hr class="sig Take a look at <b> http://goo.gl/bzlX3 WPF FlashMessage </b>
View the full article
<NFe xmlns="http://www.portalfiscal.inf.br/nfe <br/>
<infNFe Id="NFe31110207301671000131550010000010231123456780" versao="2.00
Heres the code:
<pre class="prettyprint var namespaceManager = new XmlNamespaceManager(new NameTable());
namespaceManager.AddNamespace("x", "http://www.portalfiscal.inf.br/nfe");
//selecting...
document.XPathSelectElement("//x:infNFe/@Id", namespaceManager).Value;[/code]
<br/>
But Im getting:
XPathSelectElement("//x:infNFe/@Id", namespaceManager) threw an exception of type System.InvalidOperationException <br/>
base {System.SystemException}: {"The XPath expression evaluated to unexpected type System.Xml.Linq.XAttribute."}
<hr class="sig Take a look at <b> http://goo.gl/bzlX3 WPF FlashMessage </b>
View the full article