Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Load Json Content into HtmlDocument

09.07.2018 (👁4202)

 

 

 

 

With the WebUtilty in UWP you can directly read Json returns and then search via SelectNode

The example shown shows how to read a web page into an HTML document

 

{} HtmlAgilityPack.HtmlDocument

//< get HTMLdocument >

//*create and load to local HtmlDocument

HtmlDocument doc = new HtmlDocument();

doc.LoadHtml(sHTML);

//</ get HTMLdocument >

 

 

Then you can, for example, output all TD nodes with a specific class or class name

HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(".//td[contains(@class, 'col2')]");

 

//< download >

HtmlDocument doc = await clsHtmlDoc.Web_Get_HtmlDocument(sURL);

if (doc == nullreturn false;

//</ download >

 

//< get Max Pages > 

//*read Json pages from HTMLDocument-Node 

if (intPages_Max==0)

    HtmlNode docNode = doc.DocumentNode;

    int posPages = docNode.InnerText.IndexOf("pages\":");

    int posPagesEnd = docNode.InnerText.IndexOf(",",posPages);

    posPages = posPages + "pages\":".Length;

    string sPages = docNode.InnerText.Substring(posPages, posPagesEnd - posPages);

    int intPages = 0;

    bool isNumeric = int.TryParse(sPages, out intPages);

    if (isNumeric)

    {

        intPages_Max = intPages;

    }

}

//</ get Max Pages >