| | |
XML and unicode
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2008
Posts: 58
Reputation:
Solved Threads: 1
Hello!
Is there a way to parse xml content to unicode format?
I'm getting this:
But I'd like this:
I'm using a web service to download an rss feed asynchronously to a WPF datagrid, and I get all the texts in the above format.
What could I do?
I've tried the HttpUtiliy.HtmlDecode(), but did no good at all.
Thanks in advance!
Is there a way to parse xml content to unicode format?
I'm getting this:
•
•
•
•
"Minél nagyobb a család, annál nehezebb az újdonsült barátnak-barátnőnek beilleszkedni."
•
•
•
•
"Minél nagyobb a család, annál nehezebb az újdonsült barátnak-barátnőnek beilleszkedni."
What could I do?
I've tried the HttpUtiliy.HtmlDecode(), but did no good at all.
Thanks in advance!
I've question when it loses its format? try to catch the message returned from xml webservice and see if it comes in the right format or not? I just want to put my hand on the phase content loses its format.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Also post the code you are using to fetch the RSS feed. Somewhere along the way you may be missing an opportunity to specify the proper encoding.
•
•
Join Date: Oct 2008
Posts: 58
Reputation:
Solved Threads: 1
Thank you or the answers, here is my code:
SrtipHTML is a string() method which returns a string without the html tags.
Have you got any suggestions about how should I do it?
C# Syntax (Toggle Plain Text)
public class RssData { public string title { get; set; } public string description { get; set;} public string link { get; set; } public DateTime pubDate { get; set; } public string source { get; set; } } private void Button_Click(object sender, RoutedEventArgs e) { WebClient cli = new WebClient(); Uri url = new Uri(linkbox.Text.ToString()); cli.DownloadStringCompleted += new DownloadStringCompletedEventHandler(cli_DownLoadStringCompleted); cli.DownloadStringAsync(url); } private void cli_DownLoadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { XDocument xdoc = XDocument.Parse(e.Result,LoadOptions.None); var rssFeed = from story in xdoc.Descendants("item") select new RssData { title = (story.Element("title").Value.ToString()), description = StripHTML(((string)story.Element("description"))), link = (string)story.Element("link"), pubDate = (DateTime)story.Element("pubDate"), source=(string)story.Element("link").Parent.Element("title") }; Array ase= rssFeed.ToArray(); datag.ItemsSource = ase; }
SrtipHTML is a string() method which returns a string without the html tags.
Have you got any suggestions about how should I do it?
Last edited by konczuras; Sep 15th, 2009 at 5:14 am.
•
•
Join Date: Oct 2008
Posts: 58
Reputation:
Solved Threads: 1
Oh, I forgot to mention that I've wrote the content to my console like this:
And this isn't good as well. The same strange characters are in it too.
C# Syntax (Toggle Plain Text)
Console.WriteLine(XDocument.Parse(e.Result));
![]() |
Similar Threads
- Unicode Support for Lazarus/FPC (Pascal and Delphi)
- including '/' in Xml tag (XML, XSLT and XPATH)
- Problem in Unicode Parsing. (Java)
- Help needed python unicode cgi-bin (Python)
- line drawing characters not displayed properly - python unicode (Python)
- xml modifications (Python)
- what is unicode? where we can use (PHP)
- News Story: Revised XML specifications from W3C (XML, XSLT and XPATH)
- XML "invention" Suit Launches - Who Does it Legally belong to? (RSS, Web Services and SOAP)
Other Threads in the C# Forum
- Previous Thread: From bringToFront
- Next Thread: Header Check box in data grid view is not working
Views: 384 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast button buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development drawing encryption enum event excel file files form format ftp function gdi+ http httpwebrequest image index input install java label list listbox login mandelbrot math mouseclick mysql networking object oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view webbrowser windows winforms wpf xml






