src/XMLDocumentConstructor.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 14 Mar 2021 19:58:35 +0100
branchv_0
changeset 3 68026fe3aaf5
parent 1 2179f13227f4
child 4 7230e1ea0b07
permissions -rw-r--r--
AbstractParser: documentation + close() method

/**
 * Relational pipes
 * Copyright © 2021 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, version 3 of the License.
 *
 * 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 <libxml++-2.6/libxml++/libxml++.h>

#include "lib/BasicASN1Reader.h"
#include "lib/GenericASN1ContentHandler.h"
#include "lib/DOMBuildingSAXContentHandler.h"

namespace relpipe {
namespace in {
namespace xmltable {

class XMLDocumentConstructor {
private:
	std::istream* input = nullptr;
	xmlpp::DomParser* parser = nullptr;
public:

	XMLDocumentConstructor(std::istream* input, xmlpp::DomParser* parser) : input(input), parser(parser) {
	}

	void setOption(const std::string& uri, const std::string& value) {
	}

	void process() {

		relpipe::in::asn1::lib::BasicASN1Reader reader;
		reader.write(nullptr, 0); // FIXME: transfer data from input to reader + use DOMBuildingSAXContentHandler
		reader.close();

		parser->parse_stream(*input);
	}
};

}
}
}