src/lib/DOMBuildingXMLContentHandler.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 12 Jun 2021 20:43:07 +0200
branchv_0
changeset 7 afb7f3a4981a
parent 6 src/lib/DOMBuildingSAXContentHandler.h@6a4a348426d9
child 9 7a6abdd00ab5
permissions -rw-r--r--
rename SAXContentHandler to XMLContentHandler

/**
 * 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 "XMLContentHandler.h"

namespace relpipe {
namespace in {
namespace asn1 {
namespace lib {

class DOMBuildingXMLContentHandler : public XMLContentHandler {
private:
	xmlpp::Document* document;

public:

	DOMBuildingXMLContentHandler(xmlpp::Document* document) : document(document) {
		document->create_root_node("DOMBuildingXMLContentHandler"); // FIXME: real implementation
	}

	void writeStartElement(const std::string& name, const std::vector<std::string>& attributes) override {
	}

	void writeEndElement() override {
	}

	void writeCharacters(const std::string& text) override {
	}

	void writeComment(const std::string& text, bool addSpaces) override {
		document->get_root_node()->add_child_comment(addSpaces ? " " + text + " " : text);
	}

};

}
}
}
}