Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
Latest commit
36 lines (26 loc) · 1.36 KB
/
Copy pathmain.cpp
File metadata and controls
36 lines (26 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*────────────────────────────────────────────────────────────────────────────*/
#include<nodepp/nodepp.h>
#include<nodepp/fs.h>
#include<xml/xml.h>
usingnamespacenodepp;
/*────────────────────────────────────────────────────────────────────────────*/
voidonMain() {
auto raw = xml::parse( NODEPP_STRINGIFY(
<!DOCTYPE html>
<body>
<div>
<h1> Hello World 1! </h1>
<h2> Hello World 2! </h2>
<h3> Hello World 3! </h3>
<input type="checkbox" />
<img src="http://image.png" />
</div>
</body>
));
auto el = xml::find_element( raw, "h1" );
console::log( xml::get_text( el ) );
auto im = xml::find_element( raw, "img" );
console::log( xml::get_attribute( im, "src" ) );
fs::writable( "out.json" ).write( json::stringify( raw ) );
}
/*────────────────────────────────────────────────────────────────────────────*/