Using XQuery

Discussion in 'XML' started by Lynn, Dec 12, 2007.

  1. Lynn

    Lynn Guest

    Hi ...

    I'm trying to get a handle on things XML and found the following code on
    Wikipedia:

    <html><head/><body>
    {
    for $act in doc("hamlet.xml")//ACT
    let $speakers := distinct-values($act//SPEAKER)
    return
    <span>
    <h1>{ $act/TITLE/text() }</h1>
    <ul>
    {
    for $speaker in $speakers
    return <li>{ $speaker }</li>
    }
    </ul>
    </span>
    }
    </body></html>

    I saved this in file "hamlet.htm" along with the referenced file
    ("hamlet.xml") in the same directory; when I try to open "hamlet.htm" in
    either IE6 or Firefox 2 all I get is sort of a truncated version of the
    hamlet.htm file ..

    What am I not doing right here? It's an HTML file so it would seem IE or FF
    are the right tools to use ... do they not support XQuery? Do I need to use
    a different kind of tool? Or am I thinking about all of this the wrong way
    entirely?

    btw, I have no problem opening the hamlet.xml file in either IE or Firefox,
    so it appears to be well-formed

    Any advice or information ?

    TIA
     
    Lynn, Dec 12, 2007
    #1
    1. Advertising

  2. It ISN'T an HTML file. It's an XQuery which produces an HTML file. You
    need to run it, and the input XML document, through an XQuery processor;
    that will generate an HTML file which can then be viewed with a browser.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Dec 12, 2007
    #2
    1. Advertising

  3. Lynn

    Lynn Guest

    "Joseph Kesselman" <> wrote in message
    news:476070cf$1@kcnews01...

    > It ISN'T an HTML file. It's an XQuery which produces an HTML file. You
    > need to run it, and the input XML document, through an XQuery processor;
    > that will generate an HTML file which can then be viewed with a browser.



    ok ... an XQuery processor like what? are you talking about a client-side
    GUI app, a command line tool, a server-side component I need to code against
    ? something else?

    thanks ...
     
    Lynn, Dec 13, 2007
    #3
  4. Lynn

    Pavel Lepin Guest

    Lynn <> wrote in
    <>:
    > "Joseph Kesselman" <> wrote in
    > message news:476070cf$1@kcnews01...
    >> It ISN'T an HTML file. It's an XQuery which produces an
    >> HTML file. You need to run it, and the input XML
    >> document, through an XQuery processor; that will generate
    >> an HTML file which can then be viewed with a browser.

    >
    > ok ... an XQuery processor like what? are you talking
    > about a client-side GUI app, a command line tool, a
    > server-side component I need to code against
    > ? something else?


    STFW, will you?

    --
    ....also, I submit that we all must honourably commit seppuku
    right now rather than serve the Dark Side by producing the
    HTML 5 spec.
     
    Pavel Lepin, Dec 13, 2007
    #4
  5. Lynn wrote:

    > ok ... an XQuery processor like what? are you talking about a client-side
    > GUI app, a command line tool, a server-side component I need to code against
    > ? something else?


    Saxon <http://saxon.sourceforge.net/> supports XQuery 1.0. You can run
    it from the command line, you can use it in a server-side Java component
    (e.g. servlet) too if you want.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 13, 2007
    #5
  6. Lynn

    Lynn Guest

    "Martin Honnen" <> wrote in message
    news:47613eb9$0$16569$-online.net...
    > Lynn wrote:
    >
    >> ok ... an XQuery processor like what? are you talking about a
    >> client-side GUI app, a command line tool, a server-side component I need
    >> to code against ? something else?


    > Saxon <http://saxon.sourceforge.net/> supports XQuery 1.0. You can run it
    > from the command line, you can use it in a server-side Java component
    > (e.g. servlet) too if you want.


    Thanks, Martin ... that might be helpful for getting acquainted at the
    command line; I code .NET/C# and the few articles I've seen on the web
    seem to refer to namespaces in the Framework which apparently have been
    deprecated (Microsoft.Xml.Xquery, for one) ... the current MS docs seem to
    only reference XQuery in the SQL Server context, which is not what I'm
    looking for ... I can't imagine MS has abandoned XQuery but where they've
    buried it I'm not clear on for now

    L
     
    Lynn, Dec 13, 2007
    #6
  7. Lynn

    Lynn Guest

    "Pavel Lepin" <> wrote in message
    news:fjqrl5$muf$...

    > Lynn <> wrote in
    > <>:
    >> "Joseph Kesselman" <> wrote in
    >> message news:476070cf$1@kcnews01...
    >>> It ISN'T an HTML file. It's an XQuery which produces an
    >>> HTML file. You need to run it, and the input XML
    >>> document, through an XQuery processor; that will generate
    >>> an HTML file which can then be viewed with a browser.

    >>
    >> ok ... an XQuery processor like what? are you talking
    >> about a client-side GUI app, a command line tool, a
    >> server-side component I need to code against
    >> ? something else?


    > STFW, will you?


    if you read my original post, you'd know that I *had* S'dTFW and the
    information I found was ambiguous and incomplete; if you don't want to
    respond to an inquiry, don't ... or, as you would put it: STFU ... it'll
    save you time
     
    Lynn, Dec 13, 2007
    #7
  8. Lynn wrote:

    > Thanks, Martin ... that might be helpful for getting acquainted at the
    > command line; I code .NET/C# and the few articles I've seen on the web
    > seem to refer to namespaces in the Framework which apparently have been
    > deprecated (Microsoft.Xml.Xquery, for one) ... the current MS docs seem to
    > only reference XQuery in the SQL Server context, which is not what I'm
    > looking for ... I can't imagine MS has abandoned XQuery but where they've
    > buried it I'm not clear on for now


    Saxon has a .NET API as well.
    As for Microsoft supporting XQuery, they have limited support on SQL
    Server 2005, will have slightly improved support on SQL Server 2008.
    Don't expect XQuery support in the .NET framework as provided by
    Microsoft, instead they are pushing the new LINQ and XML to LINQ
    extension in the .NET framework 3.5.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Dec 13, 2007
    #8
  9. Lynn

    Lynn Guest

    "Martin Honnen" <> wrote in message
    news:4761726b$0$16572$-online.net...

    > Saxon has a .NET API as well.
    > As for Microsoft supporting XQuery, they have limited support on SQL
    > Server 2005, will have slightly improved support on SQL Server 2008. Don't
    > expect XQuery support in the .NET framework as provided by Microsoft,
    > instead they are pushing the new LINQ and XML to LINQ extension in the
    > .NET framework 3.5.


    thanks ... that's even more helpful! what I'm wondering now is how
    "important" XQuery is as a technology; is it widely used? apparently not
    in the world of MS developers I gather ... seems like the Saxon .NET API
    might be used in the occasional project to support XQuery but I don't know
    if that warrants any significant investment of time or money .. or is it all
    too new to tell since it only became a W3C Recommendation this year?
     
    Lynn, Dec 13, 2007
    #9
  10. > what I'm wondering now is how
    > "important" XQuery is as a technology; is it widely used?
    > ...
    > too new to tell since it only became a W3C Recommendation this year?


    Pretty much.

    XQuery, like XSLT 2.0 (which is actually part of the same development
    effort; the two language specs were literally generated from the same
    source files to keep everything in sync), is relatively new and hence
    not yet widely supported or in wide use.

    Whether it *will* be important really has to be answered with "for
    whom?". XQuery doesn't really do all that much which XSLT 2.0 doesn't,
    but it looks more like the database query languages some folks are
    already used to (rather than being XML syntax). It thus may be easier
    for some folks to wrap their heads around. It's also tuned for a
    slightly different set of tasks, and is intended to evolve somewhat
    differently -- for example, XQuery may grow to include the ability to
    write back into the original document, which is not something XSLT will
    ever do. (That difference will mean the best approach for optimizing
    them also starts to diverge; it breaks the "functional language" model.)

    There was definitely demand for XQuery, which is why it was created
    alongside XSLT 2.0. Which customers actually wind up using which, only
    time will tell.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Joseph Kesselman, Dec 13, 2007
    #10
  11. Lynn

    P. Lepin Guest

    Lynn wrote:
    > "Pavel Lepin" <> wrote in message
    > news:fjqrl5$muf$...
    >> Lynn <> wrote in
    >> <>:
    >>> "Joseph Kesselman" <> wrote in
    >>> message news:476070cf$1@kcnews01...
    >>>> It ISN'T an HTML file. It's an XQuery which produces an
    >>>> HTML file. You need to run it, and the input XML
    >>>> document, through an XQuery processor; that will generate
    >>>> an HTML file which can then be viewed with a browser.
    >>>
    >>> ok ... an XQuery processor like what?

    >
    >> STFW, will you?

    >
    > if you read my original post, you'd know that I *had* S'dTFW and the
    > information I found was ambiguous and incomplete


    O rly? That's mighty interesting, because if you google for 'XQuery
    processor', the first hit is, guess what, 'The SAXON XSLT and XQuery
    Processor'. IOW, *plonk*.

    --
    Presented in Brain Control where available.
     
    P. Lepin, Dec 13, 2007
    #11
  12. Lynn

    Lynn Guest

    Thanks for the comments, Joe ... it looks to me like a technology whose day
    will likely come because it makes sense for several reasons .. but right now
    it looks like it's still off in the margins, largely in the hands of the
    cognoscenti ... at least that's what I'm seeing from comments here, Google
    Trends, frequency of Wikipedia updates on the topic and general media
    coverage ... something emerging; I'm just trying to triage all this stuff
    so I can spend my time productively


    "Joseph Kesselman" <> wrote in message
    news:47619be5$1@kcnews01...
    > > what I'm wondering now is how
    >> "important" XQuery is as a technology; is it widely used?
    > > ...
    > > too new to tell since it only became a W3C Recommendation this year?

    >
    > Pretty much.
    >
    > XQuery, like XSLT 2.0 (which is actually part of the same development
    > effort; the two language specs were literally generated from the same
    > source files to keep everything in sync), is relatively new and hence not
    > yet widely supported or in wide use.
    >
    > Whether it *will* be important really has to be answered with "for whom?".
    > XQuery doesn't really do all that much which XSLT 2.0 doesn't, but it
    > looks more like the database query languages some folks are already used
    > to (rather than being XML syntax). It thus may be easier for some folks to
    > wrap their heads around. It's also tuned for a slightly different set of
    > tasks, and is intended to evolve somewhat differently -- for example,
    > XQuery may grow to include the ability to write back into the original
    > document, which is not something XSLT will ever do. (That difference will
    > mean the best approach for optimizing them also starts to diverge; it
    > breaks the "functional language" model.)
    >
    > There was definitely demand for XQuery, which is why it was created
    > alongside XSLT 2.0. Which customers actually wind up using which, only
    > time will tell.
    >
    > --
    > Joe Kesselman / Beware the fury of a patient man. -- John Dryden
     
    Lynn, Dec 14, 2007
    #12
  13. Lynn

    Lynn Guest

    "P. Lepin" <> wrote in message
    news:fjs9j7$te9$...

    > O rly? That's mighty interesting, because if you google for 'XQuery
    > processor', the first hit is, guess what, 'The SAXON XSLT and XQuery
    > Processor'. IOW, *plonk*.



    stop being a jerk, Pavel ... Joe mentioned using an XQuery processor; why
    would I *not* ask him what HE meant?

    if you're not not going to respond civilly to reasonable questions, please,
    get me in your killfile NOW and let's be done with this
     
    Lynn, Dec 14, 2007
    #13
    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. HNguyen
    Replies:
    0
    Views:
    1,201
    HNguyen
    Jun 3, 2004
  2. amessimon

    problem using xquery and asp.net

    amessimon, Mar 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    650
    amessimon
    Mar 9, 2005
  3. Peter Saffrey

    XQuery using eXist

    Peter Saffrey, Jul 16, 2004, in forum: XML
    Replies:
    0
    Views:
    375
    Peter Saffrey
    Jul 16, 2004
  4. Suma
    Replies:
    4
    Views:
    511
  5. CK
    Replies:
    2
    Views:
    508
Loading...

Share This Page