You have shown us a very insufficient portion of the code, therefore,
I'm going to have to guess...

I think you have declared the xmlNodeId variable as an XmlAttribute.

As for your first question, all XPathNavigator.Select calls return
another XPathNavigator positioned on a single node or an
XPathNodeIterator positioned on the root of a Result set. Therefore,
you can store the result in a variable of that type.

On May 19, 8:59 pm, cmt <[email protected]> wrote:
> Is there a way to store xpath query results in a variable?
>
> Currently, I am trying to do this:
>
> Dim ERMdoc As New XPathDocument(path + "ermodel.xml")
> Dim ERMnav As XPathNavigator = ERMdoc.CreateNavigator()
>
> For Each node In ERMnav.Select("//ns1:erNode", nsmgr)
> xmlNodeId = node.SelectSingleNode("//ns1:erNode/@id", nsmgr)
> Next
>
> Response.Write (xmlNodeId)
>
> But I keep getting this error:
>
> Unable to cast object of type
> 'MS.Internal.Xml.Cache.XPathDocumentNavigator' to type
> 'System.Xml.XmlAttribute'.
>
> Am I missing something?
>
> Thanks!

Reply via email to