Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
With reference to the above i wanted to ask whether ifi want to search for data can i get it. when i type for data with subset with some character "s" i have to get title with subset s which is retrieved from the data in xml file

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 6-Aug-11 4:13am
v2
Comments
walterhevedeich 6-Aug-11 9:57am    
Please dont repost questions.
OriginalGriff 6-Aug-11 10:13am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

Loading a XML file:

C#
XDocument doc = XDocument.Load(filename);


You can do it this way regardless of the Windows platform (WinForms, WPF, Silverlight, Console, or ASP.Net) you're coding for. For asp.net, you'll have to call MapPath (with the desired filename) so that you get an actual path on the server, but that's just a minor variation.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 6-Aug-11 22:31pm    
Right, a 5. There are some more ways; I've provided a short overview, please see.
--SA
There are several different ways to parse XML in .NET; here is a short overview:


  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].


—SA
 
Share this answer
 

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