Settings for parsing raw HTML, and how to get element path from root?
See original GitHub issueHi, I have two questions:
-
If we were to parse some raw HTML, like
new HtmlParser().Parse(html)
, wherehtml
is a string with some raw HTML as text (in UTF-8 or other relevant charset encoding), then are any other settings (options
orconfiguration
) needed to make the DOM parser work best/optimized? -
Given an element (
IElement
), is it possible to get its path or depth (from root)? For example, CsQuery can return a numeric arrayNodePath
(code reference here), and other DOM parsers have similar APIs.
Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Fetch HTML and insert into DOM, but parse relative to ...
I can fetch this file and insert it into the DOM easily: const dom = document.getElementById('root'); const response = await ...
Read more >Parsing HTML in Node.js with Cheerio
Once you're done with parsing and manipulating your markup, you can access its root content with: $.root().html();.
Read more >Parsing XML and HTML with lxml
Parsing XML and HTML with lxml. lxml provides a very simple and powerful API for parsing XML and HTML. It supports one-step parsing...
Read more >Parsing HTML with Xpath
For HTML parsing, Xpath has some advantages over CSS selectors: ... our simple xpath simply describes a path from the root to the...
Read more >A Roadmap to XML Parsers in Python
In this tutorial, you'll learn what XML parsers are available in Python and how to pick the right parsing model for your specific...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is the index helper. Just use Linq (
Select
) with the statement above?From your example I assume you refer to elements (
Children
for indices. Otherwise the text nodes would be counted in).Glad I could help!