The UWP edition HTMLAGILITYPACK,UWP app uses the sample download.
Win10 released for one weeks and the SDK was released together, I installed the vs2015 and SDK to develop the UWP generic program.
When doing network parsing, installing Htmlagilitypack with NuGet is not available in the UWP generic program.
Just beginning to think of the version of the issue, then replaced several version numbers are found unusable.
Then to Htmlagilitypack official open source address: http://htmlagilitypack.codeplex.com/
Download the source code, put it into the WIN10 SDK to compile, found a lot of errors. Discover Win10sdk's own Microsoft.NETCore.UniversalWindowsPlatform
The System.xml.xpath namespace is missing, and some system methods are missing. Remove some methods, and then discover that the XML needs to be processed.
Then search online related methods, finally found in nuget Microsoft Mall uploaded System.Xml.XPath.XDocument, and then add references found feasible.
Because. Netcore Some of the missing, and then deal with some of the error methods and classes. A successful compilation is made and then added to the project can also be used. is basically out of a version.
Let's take a look at how to use this and experience the development of a UWP generic app.
1. Create a new Windows generic app.
2. Add a reference to the System.Xml.XPath.XDocument
NuGet command:
Pm> Install-package System.Xml.XPath.XDocument
You can also find additions in the project right-click NuGet.
3. Add HtmlAgilityPack.Win10.dll Reference
The final effect is as follows:
And then we can use Htmlagilitypack. Let's take the example of the editing recommendation plate for the garden.
The link address is: Http://www.cnblogs.com/aggsite/headline The final effect is as follows:
Here's just a simple example.
The main code is as follows:
Private Async voidGrid_loading (FrameworkElement sender,Objectargs) {WebRequest Request= Httpwebrequest.create ("Http://www.cnblogs.com/aggsite/headline"); WebResponse response=awaitrequest. Getresponseasync (); Stream Stream=Response. GetResponseStream (); varresult =""; using(StreamReader sr =NewStreamReader (Stream)) {Result=Sr. ReadToEnd (); } HTMLDocument Doc=NewHTMLDocument (); Doc. loadhtml (result); varNodes=doc. Documentnode.selectnodes ("//*[@id =\ "post_list\"]/div/div/h3"); foreach(varIteminchnodes) {ListViewItem LV=NewListViewItem (); Lv. Content=item. InnerText; Cnblogs. Items.Add (LV); } }
For more information, please download the sample.
sample Download with HtmlAgilityPack.Win10.dll
Http://files.cnblogs.com/files/linezero/CnblogsApp.rar
If you think this article is helpful to you, please click "Recommend", thank you.
WIN10 Generic Program UWP edition Htmlagilitypack UWP app use example