Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I just started using XML as a database with .Net not long, I am faced with the task of Selecting nodes based on criteria by passing SQL queries and keywords as (LIKE, CONTAIN,SUM etc). XML Database Format

HTML
<institutions>
<institution type="university" abbrv="absu" name="Abia State University (absu)" />
  <institution type="university" abbrv="atbu" name="Abubakar Tafawa Balewa University (atbu)" />
  <institution type="university" abbrv="achievers" name="Achievers University (achievers)" />
<institutions>


I want to be able to get institutions using LIKE, SUM and other keywords eg. Get Institution where name like '%Abia%' I dont want to use dataset before filtering, I need a direct approach to this. Please help me with some good working examples or books. thanks
Posted
Comments
Richard Deeming 26-Oct-15 15:51pm    
XML is not a database. If you need to support SQL queries, then use a database.

The closest you'll get with an XML file is LINQ to XML[^], which will let you write LINQ queries against an XML document.
Maciej Los 26-Oct-15 16:17pm    
This is an answer!

1 solution

Quote:
I just started using XML as a database

Your first mistake is XML is NOT a database. It is an eXtensible Markup Language used to format data for transmission or temporary storage. It has no query capabilities at all.

Quote:
XML Database Format

Again, there's no such thing.

If you want query capability, you'll have to use either some wrapper around the XML data that implements this, such as "LINQ to XML" (Google it) or use an actual database engine and store your data in there, like SQL Server Local Db or SQL Server Express.
 
Share this answer
 
Comments
Maciej Los 26-Oct-15 16:54pm    
+5!
Sergey Alexandrovich Kryukov 26-Oct-15 22:34pm    
Sure, a 5.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900