c# - Problems getting XML content -
i'm trying content current loading page using awesomium. if page xml(rss) result incorrect. test program demonstrate problems
using system; using system.diagnostics; using system.threading; using system.threading.tasks; using awesomium.core; namespace awesomiumtest { class program { static void main(string[] args) { webcore.initialize(new webconfig() { loglevel = loglevel.none }); string result; //example #1 //ok writepagetoconsole("http://www.google.com/"); //example #2 //small problem. result has added tags , replace "<" ">" "<" ">" writepagetoconsole("http://social.msdn.microsoft.com/search/es-es/feed?query=vb&format=rss"); //example #3 //big problem. result = 'undefined' !!!!!!! writepagetoconsole("http://prmac.com/rss-ct-d.htm"); console.readkey(); } static void writepagetoconsole(string url) { using (websession session = webcore.createwebsession(new webpreferences())) { using (webview view = webcore.createwebview(1280, 960, session)) { bool finishedloading = false; view.loadingframecomplete += (s, e) => { if (e.ismainframe) finishedloading = true; }; view.source = url.touri(); while (!finishedloading) { thread.sleep(100); webcore.update(); } string doctagname = view.executejavascriptwithresult("document.documentelement.tagname").tostring(); string outerhtml= view.executejavascriptwithresult("document.documentelement.outerhtml").tostring(); console.writeline("document tagname: " + doctagname); console.writeline("part of content: " + outerhtml.substring(0, math.min(300, outerhtml.length))); console.writeline(); } } } } }
console looking this:
example #1
document tagname: html
part of content:
<html itemscope="" itemtype="http://schema.org/webpage"><head><meta content="Поиск информации в интернете: веб страницы, картинки, видео и многое другое." name="description"><meta content="noodp" name="robots"><meta itemprop="image" content="/images/google_favicon_128.png"><title>google</title><scri
example #2
document tagname: html
part of content:
<html><head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"><rss xmlns:a10="http://www.w3.org/2005/atom" version="2.0"><channel><title>buscar en msdn</title><description>use msdn para buscar en la web.</description><item><link>h
example #3
document tagname: rss
part of content: undefined
what correct way page content in example #2 , #3?
Comments
Post a Comment