Personal tools
You are here: Home Tech Tidbits XQuery


— filed under:

Plays nice with XML docs. Create simple statements that can screenscrape, create RSS feeds from multiple documents without programming, and as a W3C standard could be used to do much without proprietary languages.


In the One Big Database, there is a standard for creating queries called XQuery. You can create new web documents by searching various web documents and bringing back the desired content whether from your own site or not. The better designed the target web sites and documents are the easier and simpler the queries are to create. 

Eventually there will be ways to have libraries of XQuery queries that allow web site administrators and researchers to create more exciting, dynamic web sites and applications and more efficiently plumb the Internet for information.


See XQuery related links

Example of XQuery Query of Live Legislative Data

  See eXist database sandbox to experiment with XQuery

Query of six roll call votes hosted on the Clerk of the House's site to extract only one Member of Congress' vote:

for $i in 10 to 15
let $thevote := concat("",$i,".xml")
let $bill := doc($thevote)//vote-metadata
let $specificvote := doc($thevote)//recorded-vote[legislator/@name-id = "E000215"]
let $result := concat(data($specificvote//legislator)," voted ",data($specificvote/vote)," ",data($bill/vote-question)," of ",data($bill//legis-num))

Returned this result

Eshoo voted Nay On Motion to Commit with Instructions of H RES 6
Eshoo voted Yea On adoption of Title 5 of the resolution of H RES 6
Eshoo voted Nay On Motion to Recommit of H RES 35
Eshoo voted Aye On Agreeing to the Resolution of H RES 35
Eshoo voted No On Motion to Recommit with Instructions of H R 1
Eshoo voted Aye On Passage of H R 1


Document Actions
What's News