EDN Admin
Well-known member
Hi,
Im creating a list which gets data from an .XML-file. I sort it by using:
XDocument loadedData = XDocument.Load("course_db.xml");
var data = from query in loadedData.Descendants("Course")
orderby (string)query.Element("Name")
select new Course
{
name = (string)query.Element("Name"),
<span style="white-spacere desc = (string)query.Element("Description"),
<span style="white-spacere url = (string)query.Element("Url"),
<span style="white-spacere location = new GeoCoordinate((double)query.Element("Latitude"), (double)query.Element("Longitude"))<br/>
};
And my .XML-file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<Courses>
<Course>
<span style="white-spacere <Name>Hackstabanan</Name>
<span style="white-spacere <Description>Ãkersberga. 18 korgar.</Description>
<span style="white-spacere <Url>http://www.akersbergafk.com/</Url>
<span style="white-spacere <Longitude>18.30541</Longitude>
<span style="white-spacere <Latitude>59.487995</Latitude>
</Course>
...
The problem i have is that when a course is names e.g. Ãrebro it gets sorted as if it was named Orebro but in the list it is named Ãrebro.
So what I want is that citys starting with Ã,à or à gets sorted last (as in the Swedish alfabet). Ive also tried with encoding the .XML with ISO-8859-1 but got the same result...
View the full article
Im creating a list which gets data from an .XML-file. I sort it by using:
XDocument loadedData = XDocument.Load("course_db.xml");
var data = from query in loadedData.Descendants("Course")
orderby (string)query.Element("Name")
select new Course
{
name = (string)query.Element("Name"),
<span style="white-spacere desc = (string)query.Element("Description"),
<span style="white-spacere url = (string)query.Element("Url"),
<span style="white-spacere location = new GeoCoordinate((double)query.Element("Latitude"), (double)query.Element("Longitude"))<br/>
};
And my .XML-file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<Courses>
<Course>
<span style="white-spacere <Name>Hackstabanan</Name>
<span style="white-spacere <Description>Ãkersberga. 18 korgar.</Description>
<span style="white-spacere <Url>http://www.akersbergafk.com/</Url>
<span style="white-spacere <Longitude>18.30541</Longitude>
<span style="white-spacere <Latitude>59.487995</Latitude>
</Course>
...
The problem i have is that when a course is names e.g. Ãrebro it gets sorted as if it was named Orebro but in the list it is named Ãrebro.
So what I want is that citys starting with Ã,à or à gets sorted last (as in the Swedish alfabet). Ive also tried with encoding the .XML with ISO-8859-1 but got the same result...
View the full article