BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XQuery
What is XQuery?
Why do I need XQuery when I already have XSLT/XPath?
XQuery 1.0 syntax types and some query examples.
How to use XQuery in ASP.NET
Learn XQuery 1.0 fundamentals
<< XmlSerializer
XSLT >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :372

 

What is XQuery and ASP.NET?

XQuery is a new XML Query Language which is a work in progress by the XML Query Working Group of the W3C. It has currently the W3C Working Draft status, but is due to reach W3C Recommendation status soon.

There has been quite some updating on the drafts published since the start of the project. This year, the most important ones were:

1. 2 May 2003: Ten NEW working drafts published (two going to LAST CALL, one new, seven updates)

2. 22 August 2003: Five (updated) working drafts published (XPath 2.0, XQuery 1.0, XQuery 1.0 and XPath 2.0 Formal Semantics, XQuery Use Cases, XPath 2.0 Requirements)

Where does XQuery stand in the jungle of XML related languages? Well, we could visualize this roughly as follows (note that no complete overview is shown, for the sake of simplicity):

 

Fig. 1: XQuery's relation to other W3C XML related specifications

In the above diagram, the specifications above the dashed line are W3C Recommendations. The specifications below the dashed line are currently what the W3C calls "Works in Progress"; as you can see, XQuery 1.0 is one of them.

Furthermore, we see that XPath 1.0 first was part of XSL 1.0 but later on grew out as a fully separate specification. The main reason for that was that XPath is being reused in other W3C specifications.

XQuery is a strongly-typed language, and its data type system is based on XML Schema (http://www.w3.org/XML/Schema). Like XPath, XML Schema is also being re-used in other specifications.

XQuery 1.0 is tightly related to XPath 2.0, in that XQuery 1.0 is actually a superset of XPath 2.0. XPath 2.0 is also used by the upcoming XSLT 2.0 specification, which means that XSLT 2.0 will also be a superset of XPath 2.0.

Whereas XSLT 1.0 is a transforming language and is single document based, XQuery 1.0 is more a querying language, is multiple documents based, and is more suitable for big XML source documents. In the end, it is expected that both will co-exist, and each one will cover different areas of possible applications, but also will share some overlap in certain areas, due to their similarities.

You can read up more detailed on the subject at: http://www.w3.org/XML/Query. If you intend to do this, the first document you should read is "XQuery 1.0: An XML Query Language", available at: http://www.w3.org/TR/xquery/. That document will give you a general idea what XQuery has to offer without going into too much detail.

XQuery is basically a set of XQuery Expression types, which make up a query. We'll see some basic examples of them a bit later on. From now on, in the context of this tutorial, let's call an XQuery Expression simply an xquery.

As you may know, ASP.NET basically has the System.Xml namespace which extensively supports the use of XML in .NET code. The MS XQuery Demo managed class set adds the capability to use XQuery in conjunction with System.Xml and other .NET classes. We'll go into this early XQuery implementation a bit further on.

To run an xquery in ASP.NET, you need at least an XML source document, be it a file on disk, or a dynamically generated one from for example a database. You could also query a XML database. The important thing to remember here is that the XML source needs to be well-formed. Validating the XML is not required here, but you could always validate the XML prior to applying it an xquery, of course. Then, you would need to write your xquery to run over one or more input XML source documents.

To augment your understanding of how it all works, let us now first see what exactly is MS XQuery Demo before we move on to creating a test page in ASP.NET and run some basic xqueries.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
conference calling
swimming pool builder
spfxmasks
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP