Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Using XQuery

Reply
Thread Tools

Using XQuery

 
 
Lynn
Guest
Posts: n/a
 
      12-12-2007

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


 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-12-2007
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
 
Reply With Quote
 
 
 
 
Lynn
Guest
Posts: n/a
 
      12-13-2007

"Joseph Kesselman" <(E-Mail Removed)> 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 ...



 
Reply With Quote
 
Pavel Lepin
Guest
Posts: n/a
 
      12-13-2007

Lynn <(E-Mail Removed)> wrote in
<(E-Mail Removed)>:
> "Joseph Kesselman" <(E-Mail Removed)> 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.
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      12-13-2007
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/
 
Reply With Quote
 
Lynn
Guest
Posts: n/a
 
      12-13-2007

"Martin Honnen" <(E-Mail Removed)> wrote in message
news:47613eb9$0$16569$(E-Mail Removed)-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


 
Reply With Quote
 
Lynn
Guest
Posts: n/a
 
      12-13-2007

"Pavel Lepin" <(E-Mail Removed)> wrote in message
news:fjqrl5$muf$(E-Mail Removed)...

> Lynn <(E-Mail Removed)> wrote in
> <(E-Mail Removed)>:
>> "Joseph Kesselman" <(E-Mail Removed)> 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



 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      12-13-2007
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/
 
Reply With Quote
 
Lynn
Guest
Posts: n/a
 
      12-13-2007

"Martin Honnen" <(E-Mail Removed)> wrote in message
news:4761726b$0$16572$(E-Mail Removed)-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?





 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-13-2007
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
Update Query using XQuery CK XML 2 11-27-2006 09:43 PM
Simple aggregation using xquery Suma XML 4 07-24-2006 04:25 PM
problem using xquery and asp.net amessimon ASP .Net 1 03-09-2005 10:42 AM
XQuery using eXist Peter Saffrey XML 0 07-16-2004 03:41 PM



Advertisments