Click here to Skip to main content
15,886,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I have xml code look like this. x366 :D
HTML
<prayertimes dayofyear="192" day="11" month="7">
3:18	3:39	5:35	6:28	12:58	13:21	17:20	18:33	20:01	20:46	21:47	22:42	23:00	12:27	22.1036908	9.6633100
</prayertimes>

I want read "20:46" only(tenth one). Can i read this? If possible how?
Posted
Updated 11-Jul-13 1:32am
v2
Comments
[no name] 11-Jul-13 6:49am    
What have you tried? Did you look at the Split function?
berkayerdi 11-Jul-13 7:21am    
i dont know spit func. how to use. But i will look

Read the value of the XML element into a string, then user the "Split" function
Looking at how you have pasted it, I imagine it is a tab deliminated string.
You can use the split function to split by tab and then just read the 10th entry.
 
Share this answer
 
Comments
berkayerdi 11-Jul-13 7:01am    
I read this. my parameter is here= 3:18\t3:39\t5:35\t.... Now What should I make?
if you want always the same position then this will help you

C#
var xdoc = XDocument.Load(PathOfYourXmlFile);
      var companies = xdoc.Descendants("prayertimes").Select(c => (string)c).ToArray();
      string value = companies[0].TrimStart();
      string[] split = value.Split('\t');
      string ouptut = split[9];

output string will hold 20:46 that what you want
 
Share this answer
 
Comments
berkayerdi 11-Jul-13 7:19am    
this was good but. I cant understand ".Select(c => (string)c).ToArray();" . Can we do it with (from elm
where elm
select elm ????
vinayakJJ 11-Jul-13 7:28am    
this is linq simplest way to find the data frm xml element
Descendant method will find only that element and convert it to string and the create array of it
that array will hold all the elements value from xml file which is prayertimes
so you will have an array of value of element "prayertimes"
berkayerdi 11-Jul-13 7:31am    
thank u so much! That's OKAY :)

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