Microsoft.Xml.XQuery math expression error

I'm newer in Microsoft.Xml.XQuery, when I'm trying to run a xquery with math expression like sum i have the error : Cannot apply Add to non integer data.

XML:

<book category="COOKING">
  <title lang="en">Everyday Italian</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>30.00</price>
</book>

XQuery:

for $item in document("xqt")/bookstore/book[price < '30']
return $item/year/text()  +  $item/year/text() 

C#:

  XmlDocument doc1 = new XmlDocument();
        doc1.LoadXml(rteXml.Text);
        XQueryNavigatorCollection navCol = new XQueryNavigatorCollection();
        navCol.AddNavigator(doc1.CreateNavigator(), "xqt");

        XQueryExpression expr = new XQueryExpression(rteXQuery.Text.Trim().Replace("\\n", " "));

        XQueryNavigator nav = expr.Execute(navCol);

        rteOutput.Text = nav.ToXml();

Any ideas?

Answers


for $item in document("xqt")/bookstore/book[price < '30']
return sum($item/year/text(), $item/price/text()) 

Need Your Help

on click showing confirmation box

javascript forms function

I'm new in web development. I want to create a function which will show a confirm box by clicking on delete button (if row selected). I have also try to make it, my function working properly but i ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.