In .NET1.2, XQuery is supported, XQuery uses a query language called FLWOR. The example is as follows:
using System; using System.IO; using System.Xml; using System.Xml.Query; using System.Data.SqlXml; namespace XQuery {public class XQuerySample {public static void Main (string [] args) {System.Xml.XmlDataSourceResolver DS = new system.xml.xmldatasourceResolver (); ds.add ("bookstore", "books.xml"); streamwriter Writer = new streamwriter ("output.xml"); string query = @ " {for $ b in document ( 'bookstore') / bookstore / book where $ b / @ genre = 'philosophy' and $ b / @ publicationdate = '1991' return $ b / title} bookstore> "; XQueryProcessor xp = new XQueryProcessor ( ); Xp.compile (query); xp.execute (ds, write); Writer.Close ();}}}
Books.xml
XML Version = "1.0" Encoding = "UTF-8"?> The autobiography of benjamin franklin title> Benjamin first-name> franklin last-name> < / author> 8.99 price> book> The confidence man title> < Author> Herman first-name> Melville last-name> author> 11.99 price> book> The gorgias title> Plato name> author> 9.99 price> Book> bookstore> Output.xml
XML Version = "1.0" encoding = "UTF-8"?> The gorgias title> bookstore>