author | František Kučera <franta-hg@frantovo.cz> |
Thu, 10 Jan 2019 20:05:13 +0100 | |
branch | v_0 |
changeset 1 | 9aed8c2ea97d |
parent 0 | 751260846c40 |
child 2 | 3ab78bf63467 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 |
* |
|
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
|
8 |
* (at your option) any later version. |
|
9 |
* |
|
10 |
* This program is distributed in the hope that it will be useful, |
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
* GNU General Public License for more details. |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License |
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
#pragma once |
|
19 |
||
20 |
#include <cstdlib> |
|
21 |
#include <iostream> |
|
22 |
#include <string> |
|
23 |
#include <vector> |
|
24 |
#include <algorithm> |
|
25 |
||
1
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
26 |
#include <xercesc/sax2/SAX2XMLReader.hpp> |
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
27 |
#include <xercesc/sax2/XMLReaderFactory.hpp> |
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
28 |
#include <xercesc/sax2/DefaultHandler.hpp> |
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
29 |
#include <xercesc/util/XMLString.hpp> |
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
30 |
|
0 | 31 |
#include <relpipe/writer/typedefs.h> |
32 |
||
33 |
namespace relpipe { |
|
34 |
namespace in { |
|
35 |
namespace xml { |
|
36 |
||
37 |
class XMLCommand { |
|
38 |
public: |
|
39 |
||
40 |
void process(std::istream& input, std::ostream& output) { |
|
41 |
using namespace relpipe::writer; |
|
1
9aed8c2ea97d
add Xerces-C++ dependency
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
42 |
using namespace xercesc; |
0 | 43 |
std::shared_ptr<RelationalWriter> writer(Factory::create(output)); |
44 |
||
45 |
// TODO: remove demo |
|
46 |
// Various data types passed as strings |
|
47 |
writer->startRelation(L"xml",{ |
|
48 |
{L"s", TypeId::STRING}, |
|
49 |
{L"i", TypeId::INTEGER}, |
|
50 |
{L"b", TypeId::BOOLEAN} |
|
51 |
}, true); |
|
52 |
||
53 |
writer->writeAttribute(L"a"); |
|
54 |
writer->writeAttribute(L"1"); |
|
55 |
writer->writeAttribute(L"true"); |
|
56 |
||
57 |
} |
|
58 |
}; |
|
59 |
||
60 |
} |
|
61 |
} |
|
62 |
} |