Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yumetodo/boost_html_parse
https://teratail.com/questions/25158
https://github.com/yumetodo/boost_html_parse
Last synced: 11 days ago
JSON representation
https://teratail.com/questions/25158
- Host: GitHub
- URL: https://github.com/yumetodo/boost_html_parse
- Owner: yumetodo
- License: bsl-1.0
- Created: 2016-01-23T16:24:13.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-27T03:29:40.000Z (about 9 years ago)
- Last Synced: 2025-01-21T00:51:43.017Z (14 days ago)
- Language: C++
- Size: 45.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
parse HTML by using Boost.PropertyTree
for
https://teratail.com/questions/25158# Install
Require [boost](http://www.boost.org/).
When you use VS-Solution file, please set Environment variable ``$(BOOST_ROOT)`` and ``$(BOOST_LIB)``.# Support Compiler
using C++11(constexpr, noexcept).
- Visual Studio 2015 Upadte 1
- Visual Studio 2015 Clang with Microsoft CodeGen clang3.7
- msys2 mingw clang++ 3.7.0
- msys2 mingw g++ 5.3.0# Usage
Watch ``Source.cpp``.
```cpp
const std::vector result = html_extract(L"sample.html", L"div.inner");
```call ``html_extract`` like this.
First argument is filename to analyse. specify relative path from current directory.
Secound argument is search key. The format is same as css's selector(See below).Don't forget to call ``std::wcout.imbue`` before call ``html_extract`` when you want to use ``std::wcout``.
## Support selector
| Selector | Example | Example description |
|----------------------------------------------------------------------------|------------|-----------------------------------------|
| [.class](http://www.w3schools.com/cssref/sel_class.asp) | .intro | Selects all elements with class="intro" |
| [#id](http://www.w3schools.com/cssref/sel_id.asp) | #firstname | Selects the element with id="firstname" |
| [element](http://www.w3schools.com/cssref/sel_element.asp) | p | Selects all,elements |
| [element element](http://www.w3schools.com/cssref/sel_element_element.asp) | div p | Selects all,elements inside,elements |