blob: 23531f7b48b1ad36c1868b883ab2739656363af0 (
plain)
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
37
38
39
40
41
42
43
44
|
// file : tests/web/xhtml/driver.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <iostream>
#include <xml/serializer>
#include <web/xhtml>
using namespace std;
using namespace xml;
int
main ()
{
using namespace web::xhtml;
serializer s (cout, "output");
s << HTML
<< HEAD
<< TITLE << "Example XHTML5 document" << ~TITLE
<< ~HEAD
<< BODY
//
// Inline elements (no indentation).
//
<< P << "Here be " << B << "Dragons!" << ~B << *BR
<< "and a newline" << ~P
//
// Various ways to specify attributes.
//
<< P(ID=123, CLASS="cool") << "Text" << ~P
<< P << (ID=123) << (CLASS="cool") << "Text" << ~P
<< P << ID(123) << CLASS("cool") << "Text" << ~P
<< P << ID << 123 << ~ID << CLASS << "cool" << ~CLASS << "Text" << ~P
//
// Empty element with attributes.
//
<< P << "Text" << *BR(CLASS="double") << ~P
<< ~BODY
<< ~HTML;
}
|