From 2615896faa646e5830abf2c269150e1165c66515 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- libxsd/libxsd/cxx/parser/document.hxx | 88 +++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 libxsd/libxsd/cxx/parser/document.hxx (limited to 'libxsd/libxsd/cxx/parser/document.hxx') diff --git a/libxsd/libxsd/cxx/parser/document.hxx b/libxsd/libxsd/cxx/parser/document.hxx new file mode 100644 index 0000000..c142f57 --- /dev/null +++ b/libxsd/libxsd/cxx/parser/document.hxx @@ -0,0 +1,88 @@ +// file : libxsd/cxx/parser/document.hxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef LIBXSD_CXX_PARSER_DOCUMENT_HXX +#define LIBXSD_CXX_PARSER_DOCUMENT_HXX + +#include +#include // std::size_t + +#include +#include + +namespace xsd +{ + namespace cxx + { + namespace parser + { + // If you want to use a different underlying XML parser, all you + // need to do is to route events to this interface. + // + template + class document + { + public: + virtual + ~document (); + + document (parser_base& root, + const std::basic_string& ns, + const std::basic_string& name); + + public: + // The type argument is a type name and namespace from the + // xsi:type attribute in the form " " with + // the space and namespace part absent if the type does not + // have a namespace or 0 if xsi:type is not present. + // + void + start_element (const ro_string& ns, + const ro_string& name, + const ro_string* type); + + void + end_element (const ro_string& ns, const ro_string& name); + + void + attribute (const ro_string& ns, + const ro_string& name, + const ro_string& value); + + void + characters (const ro_string&); + + protected: + document (); + + // This function is called to obtain the root element type parser. + // If the returned pointed is 0 then the whole document content + // is ignored. + // + virtual parser_base* + start_root_element (const ro_string& ns, + const ro_string& name, + const ro_string* type); + + // This function is called to indicate the completion of document + // parsing. The parser argument contains the pointer returned by + // start_root_element. + // + virtual void + end_root_element (const ro_string& ns, + const ro_string& name, + parser_base* parser); + + private: + parser_base* root_; + std::basic_string ns_; + std::basic_string name_; + std::size_t depth_; + }; + } + } +} + +#include + +#endif // LIBXSD_CXX_PARSER_DOCUMENT_HXX -- cgit v1.1