Programming Help by Programmer's hub

XQuery Programming language

XQuery is a query and functional programming language designed design to query and transform collection of structured and unstructured data usually in the form of XML, text and with vendor-specific extensions for other data formats. Studies have shown that people familiar with SQL can quickly learn XQuery. Once developers understand the structure of the FLWOR statement, many SQL concepts such as sorting and selecting distinct values are easily learned. The XQuery lauage is based on the XPath query language, It creates the tree structure model of the content which is used for the searching and indexing the data in the XML file.

XQuery programming code example

{`
<html><head/><body>

 {

   for $act in doc("hamlet.xml")//ACT

   let $speakers := distinct-values($act//SPEAKER)

   return

     <div>

       <h1>{ string($act/TITLE) }</h1>

       <ul>

       {

         for $speaker in $speakers

         return <li>{ $speaker }</li>

       }

       </ul>

     </div>

 }

 </body></html>
 `}
...

Features of XQuery programming Language

  •  Logical/physical data independence
  • Declarative
  • High level
  • Side-effect free
  • Strongly typed