How to use HAPPhone APIs to achieve this function

Topics: Developer Forum, User Forum
Apr 25, 2012 at 1:06 AM

Hi,

I have ran into a problem usig XmlReader on WP7. It is because it does not support BIG5 encoding when trying to read XML content.

Here is what I was trying to do.

using (XmlReader reader = XmlReader.Create(http://feeds.feedburner.com/nownews/politic)
while (reader.Read())  // iterate through the document
   
switch (reader.NodeType)  
       
case XmlNodeType.Text:  
           
string s = reader.Value; //looking for content under all <item>

I wonder if someone can give quick code so that I can try if I can get character display correctly on device. Very appreciated!

thsieh 

May 11, 2012 at 4:16 PM

Does the xml look like this: <text>Text you're trying to read</text>

Assuming the above is true, you can create a list of text strings like this:

HtmlWeb.LoadAsync("http://feeds.feedburner.com/nownews/politic", handleResults);

public void handleResults(object o, HtmlDocumentLoadCompleted args)
{
     IEnumerable<string> textList = args.Document.DocumentNode.Descendants("text").Select(x => x.InnerText);

}