Skip to content

Commit 8633ae8

Browse files
committed
Update README.md
1 parent 4a513c1 commit 8633ae8

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#Smallcode.Net
22
Fluent HttpWebClient, Http parser and Json parser.
3+
34
### Usage
5+
6+
#### HttpWebClient
7+
48
```csharp
59
string result = new Url("http://www.xxx.com").CreateRequest().Get();
610
string 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+
```

0 commit comments

Comments
 (0)