File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#Smallcode.Net
22Fluent HttpWebClient, Http parser and Json parser.
3+
34### Usage
5+
6+ #### HttpWebClient
7+
48``` csharp
59string result = new Url (" http://www.xxx.com" ).CreateRequest ().Get ();
610string result = new Url (" http://www.xxx.com" ).CreateRequest ()
@@ -19,3 +23,24 @@ string result = new Url("http://www.xxx.com").CreateRequest()
1923 .ByAjax ()
2024 .Post (data );
2125```
26+
27+ #### Http parser
28+
29+ ``` csharp
30+ // FindElement
31+ var html = Html .Parse (" <div class=\" class\" id=\" id\" name=\" name\" ><a href=\" http://www.test.com\" >click me</a></div><div class=\" class other\" id=\" other\" ><a href=\" http://www.test1.com\" >click me</a></div>" );
32+ var name = html .FindElement (By .TagName (" div" )).GetAttribute (" name" ); // should be : name
33+ var name = html .FindElement (By .TagName (" TagName" )).GetAttribute (" name" );
34+ var name = html .FindElement (By .ClassName (" class" )).GetAttribute (" name" );
35+ var name = html .FindElement (By .XPath (" //div" )).GetAttribute (" name" );
36+ var href = html .FindElement (By .LinkText (" click me" )).GetAttribute (" href" ); // should be : http://www.test.com
37+ var href = html .FindElement (By .PartialLinkText (" click" )).GetAttribute (" href" ); // should be : http://www.test.com
38+
39+ // FindElements
40+ var elements = html .FindElements (By .TagName (" div" ));
41+ ```
42+
43+ #### Json parser
44+
45+ ``` csharp
46+ ```
You can’t perform that action at this time.
0 commit comments