0

私は Microsoft.Xml.XQuery のほうが新しく、sum のような数式で xquery を実行しようとすると、次のエラーが表示されます: Add を非整数データに適用できません。

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();

何か案は?

4

1 に答える 1

0
for $item in document("xqt")/bookstore/book[price < '30']
return sum($item/year/text(), $item/price/text()) 
于 2013-05-03T07:10:39.020 に答える