problem using xquery and asp.net

Discussion in 'ASP .Net' started by amessimon, Mar 7, 2005.

  1. amessimon

    amessimon Guest

    Hi

    I'm having a problem querying an XML document using Xquery, i dont know if
    this is the right place to post, but i couldnt find an xquery newsgroup.
    Ive also posted in the xml group. Ive not used xquery before and cant find
    much documentation online regarding the problem i am encountering.

    Im running the following code, which is a simple query....(ive included all
    of it as its short and for the sake of completeness).

    ########################################################

    <%@ Import Namespace="System.Xml" %>
    <%@ Import Namespace="Microsoft.Xml.XQuery" %>
    <%@ Import NameSpace="System.IO" %>
    <script language="vb" runat="server">
    Sub page_load()
    Dim col as New XQueryNavigatorCollection()
    col.AddNavigator(server.mappath("test.xml"), "foo")
    Dim query as String
    query = "for $x in doc(""foo"")/SEARCHRESULTS/RESULTSET/RESULT " & _
    "where $x/URL = ""somestring"" " & _
    "return $x/REDIR"
    Dim expr as New XQueryExpression(query)
    Dim rawXML as String = (expr.Execute(col)).ToXml()
    End sub
    </script>

    ########################################################

    This returns the following exception

    "Microsoft.Xml.XQuery.XQueryException: User Defined Functions not supported.
    "

    Im puzzled as to why this is as I can see nothing wrong with the query?

    Thanks for any advice in advance

    amessimon
     
    amessimon, Mar 7, 2005
    #1
    1. Advertising

  2. amessimon

    amessimon Guest

    Sorted it, was a simple typo

    replace 'doc(""foo"")' with 'document(""foo"")'


    "amessimon" <> wrote in message
    news:s7XWd.87$...
    > Hi
    >
    > I'm having a problem querying an XML document using Xquery, i dont know if
    > this is the right place to post, but i couldnt find an xquery newsgroup.
    > Ive also posted in the xml group. Ive not used xquery before and cant find
    > much documentation online regarding the problem i am encountering.
    >
    > Im running the following code, which is a simple query....(ive included
    > all of it as its short and for the sake of completeness).
    >
    > ########################################################
    >
    > <%@ Import Namespace="System.Xml" %>
    > <%@ Import Namespace="Microsoft.Xml.XQuery" %>
    > <%@ Import NameSpace="System.IO" %>
    > <script language="vb" runat="server">
    > Sub page_load()
    > Dim col as New XQueryNavigatorCollection()
    > col.AddNavigator(server.mappath("test.xml"), "foo")
    > Dim query as String
    > query = "for $x in doc(""foo"")/SEARCHRESULTS/RESULTSET/RESULT " & _
    > "where $x/URL = ""somestring"" " & _
    > "return $x/REDIR"
    > Dim expr as New XQueryExpression(query)
    > Dim rawXML as String = (expr.Execute(col)).ToXml()
    > End sub
    > </script>
    >
    > ########################################################
    >
    > This returns the following exception
    >
    > "Microsoft.Xml.XQuery.XQueryException: User Defined Functions not
    > supported. "
    >
    > Im puzzled as to why this is as I can see nothing wrong with the query?
    >
    > Thanks for any advice in advance
    >
    > amessimon
    >
    >
    >
    >
     
    amessimon, Mar 9, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken North
    Replies:
    0
    Views:
    426
    Ken North
    Apr 17, 2004
  2. Peter Saffrey

    XQuery using eXist

    Peter Saffrey, Jul 16, 2004, in forum: XML
    Replies:
    0
    Views:
    370
    Peter Saffrey
    Jul 16, 2004
  3. Suma
    Replies:
    4
    Views:
    488
  4. CK
    Replies:
    2
    Views:
    491
  5. Lynn

    Using XQuery

    Lynn, Dec 12, 2007, in forum: XML
    Replies:
    12
    Views:
    1,209
Loading...

Share This Page