src/XMLTableCommand.h
author František Kučera <franta-hg@frantovo.cz>
Wed, 24 Jul 2019 12:15:10 +0200
branchv_0
changeset 0 a37196931f63
child 2 0d3eb5129582
permissions -rw-r--r--
project skeleton, libxml2

/**
 * Relational pipes
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>

#include <libxml++-2.6/libxml++/libxml++.h>

#include <relpipe/writer/typedefs.h>


namespace relpipe {
namespace in {
namespace xmltable {

using namespace relpipe::writer;

class XMLCommand {
private:

public:

	void process(std::istream& input, std::ostream& output) {


		xmlpp::DomParser parser;
		parser.parse_stream(input);
		xmlpp::Document* d = parser.get_document();
		xmlpp::Element* r = d->get_root_node();

		xmlpp::Node::PrefixNsMap m;
		m["rp"] = "tag:globalcode.info,2018:relpipe";

		output << "root: " << r->get_name() << std::endl;

		for (xmlpp::Node* n : r->find("//rp:attribute", m)) {

			output << "node:" << n->get_name() << std::endl;

		}


	}
};

}
}
}