Questions tagged [csquery]

CsQuery is a complete CSS selector engine, HTML parser, and jQuery port for C# and .NET 4+

CsQuery is a jQuery port for .NET 4. It implements all CSS2 & CSS3 selectors, all the DOM manipulation methods of jQuery, and some of the utility methods. The majority of the jQuery test suite (as of 1.6.2) has been ported to C#. Here is its official github.

69 questions
6
votes
1 answer

Parsing HTML with CSQuery

How can I retrieve the value from a div tag via the ID using CSQuery? For example,

Room 1
145

In this case I'd like to get the content inside type and price.
bluewonder
  • 767
  • 2
  • 10
  • 18
5
votes
1 answer

CsQuery to parse a collection of li items

Here's my code: CQ dom = CQ.Create(htmlString); var items = dom[".blog-accordion li"]; foreach (var li in items) { var newTournament = false; var test = li["header h2"]; } Inside the foreach loop li turns into a IDomObject variable and I…
sergserg
  • 21,716
  • 41
  • 129
  • 182
4
votes
4 answers

Parse Html Document Get All input fields with ID and Value

I have several thousand (ASP.net - messy html) html generated invoices that I'm trying to parse and save into a database. Basically like: foreach(var htmlDoc in HtmlFolder) { foreach(var inputBox in htmlDoc) { //Make Collection of ID…
bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83
4
votes
1 answer

Create new CsQuery object without inheritance

directly to the question: I have CsQuery object with some data. CQ html=new CQ("

"); I want to get p and assign it to a new CQ object : Cq newHtml=html["p"]; When I do that, it also inherits the …
nazarkin659
  • 503
  • 3
  • 11
4
votes
1 answer

How to get javascript variable value from HTML using CsQuery

How to get javascript variable value from DOM using CsQuery?
Nitin Sawant
  • 7,278
  • 9
  • 52
  • 98
4
votes
1 answer

Issue parent() in jQuery

Imagine some HTML code : and $("a.result:first").parent().select('a'); As I think it…
nazarkin659
  • 503
  • 3
  • 11
4
votes
1 answer

Make changes inside an Each block persistent

I have been trying the fantabulous CsQuery library, which is basically a .NET port for jQuery allowing the use os CSS selectors and most of jQuery's functionalities. I am using it to parse and edit a batch of HTML files (particularly, editing some…
Sam
  • 1,222
  • 1
  • 14
  • 45
2
votes
1 answer

CsQuery replace tags

I using CsQuery in order to parse HTML documents. What I'm trying to do is to replace all the "br" HTML tags with "." character. Assuming that this is my input HTML: Hello
World The…
No1Lives4Ever
  • 6,430
  • 19
  • 77
  • 140
2
votes
1 answer

CsQuery - Unwrap element with whitespace character between

I'm trying to unwrap a string in CsQuery. The functionality works, but I want to add a whitespace char between each tag. Dim fragment = CsQuery.CQ.Create(
some text
More text
) Dim unwrapTags = New List(Of String) With…
CosX
  • 1,920
  • 2
  • 15
  • 25
2
votes
2 answers

Using selectors with csQuery

I am very new to csQuery and I am having a difficult time getting off the ground. The following is my simple asp.net controller. It is returning the following: $('.ng-scope').eq(0).find($('.ng-binding')).html(). The classes referenced do exist. Am I…
spooky123
  • 143
  • 3
  • 11
2
votes
0 answers

Stability of CsQuery 1.3.5-beta5?

Can anyone comment from experience on the stability of CsQuery 1.3.5-beta5? (https://www.nuget.org/packages/CsQuery/1.3.5-beta5). I am about to spike CsQuery and notice that 1.3.5 includes "significant performance improvements and bug fixes". Of…
robs
  • 840
  • 10
  • 15
2
votes
2 answers

Traverse the dom with CsQuery

I'm trying to learn how to use CsQuery to traverse a dom to get specific text. The html looks like this:
2
votes
2 answers

CSQuery foreach iteration

I am using this to get some data: string s = dom["table .lotto strong"].Text(); But I get everything in 1 line. For can I parse each element from that table separately and manipulate it (for example add
after each element, so I don't get…
sensei
  • 7,044
  • 10
  • 57
  • 125
2
votes
2 answers

CsQuery - getting sibling values between two selectors?

I'm trying to parse out values from a large HTML page and I'm struggling with how to extract text from between two selectors. Here's my example HTML to illustrate:
Eddie
  • 1,228
  • 3
  • 17
  • 31
1
2 3 4 5