We need to see all of the XML to determine the error.
<lisa@starways.net> wrote in message
news:1148414925.973992.277950@j33g2000cwa.googlegroups.com...
>I have an XML file that starts like this:
>
> <?xml version="1.0" encoding="ISO-8859-1"
> xmlns:fn="
http://www.w3.org/2005/xpath-functions"?> > <Authors>
> <Author>
> <ID>2</ID>
> <UserName>Whoever</UserName>
> <Title>Whatever</Title>
> <Internet>email</Internet>
> <Office>email</Office>
> </Author>
>
> It has multiple "<Author>" nodes.
>
> I have VB.NET code that looks like this:
>
> Dim doc As new XPathDocument(_fileName)
> Dim nav As XPathNavigator = doc.CreateNavigator()
>
> 'set selection criteria
> Dim crit As String
> crit = "fn:distinct-values(descendant::Author/Office)"
>
> 'select and sort
> Dim expr As XPathExpression
> expr = nav.Compile(crit)
> expr.AddSort("Office", XmlSortOrder.Ascending,
> XmlCaseOrder.None, _
> "", XmlDataType.Text)
>
> 'store results in collection
> Dim iter As XPathNodeIterator
> Try
> iter = nav.Select(expr)
> Catch ex As Exception
> MsgBox(ex.Message)
> End Try
>
> And that's where I get the error. I found the functions at
>
http://www.w3schools.com/xpath/xpath_functions.asp and put the fn
> namespace into the XML file so that I can use them. But the error
> message that comes up when I try to select that expression is:
>
> This is an unexpected token. The expected token is 'NAME'. Line 1,
> position 43.
>
> The 43rd character on the 1st line is the "x" in "xmlns:fn". What kind
> of token is the parser looking for?
>
> Thanks,
> Lisa
>