Hi,
I've got following XML:
I stored that xml once at a webserver and once at a local file. I'm reading the file with following code:Code:<?xml version="1.0" encoding="utf-8"?> <root> <Map livescore="Arka Gdynia" betfair=" Arka Gdynia" /> <Map livescore="Wisla Krakow" betfair="Wisla Krakow " /> <Map livescore="Olhanense SC" betfair=" Olhanense" /> <Map livescore="Uniao Leiria" betfair="Leiria " /> </root>
I'm calling the function that way:Code:private IScore injectBetfairIntern(String strBFTeamA, String strBFTeamB, String uri) { XDocument feed = null; try { feed = XDocument.Load(uri); } catch (FileNotFoundException fnfe) { return null; } var mappingTeamA = from map in feed.Descendants("Map") where map.Attribute("betfair").Value == strBFTeamA select new { Betfair = map.Attribute("betfair").Value, GamblerWiki = map.Attribute("livescore").Value }; var mappingTeamB = from map in feed.Descendants("Map") where map.Attribute("betfair").Value == strBFTeamB select new { Betfair = map.Attribute("betfair").Value, GamblerWiki = map.Attribute("livescore").Value }; foreach (var mapA in mappingTeamA) { foreach (var mapB in mappingTeamB) { IDictionaryEnumerator enumLivescore = m_list.GetEnumerator(); while (enumLivescore.MoveNext() == true) { LiveScore score = (LiveScore)enumLivescore.Value; if (score.TeamA.Equals(mapA.GamblerWiki.Trim()) && score.TeamB.Equals(mapB.GamblerWiki.Trim())) { Debug.WriteLine(String.Format("Added match {0} - {1} to watch", score.TeamA, score.TeamB)); return score.IncreaseRef(); } } } } return null; }
The strange thing is, that if I'm taking the online xml the values are found. But if I'm taking the local xml (delete the entries from the online xml to get to the local xml) it doesn't find the entries.Code:String uri = "http://www.myserver.com/myxml.xml"; IScore score = injectBetfairIntern(strBFTeamA, strBFTeamB, uri); if (score == null) { uri = Application.StartupPath + @"\mylocalxml.xml"; score = injectBetfairIntern(strBFTeamA, strBFTeamB, uri); }
I have no idea what could be wrong there. Does anyone here know something?
Thanks in Advance
akademos


Reply With Quote
