summaryrefslogtreecommitdiff
path: root/examples/cxx/tree/streaming/parser.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-10-13 11:29:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-10-13 11:29:26 +0200
commitafebd79d44b75aed3b38e867c65330ba80ddc0ee (patch)
tree7fc95caae113884defce1ac712f93327f58f72e0 /examples/cxx/tree/streaming/parser.hxx
parent0b21758fcd9f3127e30a1c9172c4c27b46a2b957 (diff)
Extended the streaming example
It now shows how to perform stream-oriented, partially in-memory XML processing using the C++/Tree mapping.
Diffstat (limited to 'examples/cxx/tree/streaming/parser.hxx')
-rw-r--r--examples/cxx/tree/streaming/parser.hxx46
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/cxx/tree/streaming/parser.hxx b/examples/cxx/tree/streaming/parser.hxx
new file mode 100644
index 0000000..000d022
--- /dev/null
+++ b/examples/cxx/tree/streaming/parser.hxx
@@ -0,0 +1,46 @@
+// file : examples/cxx/tree/streaming/parser.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : not copyrighted - public domain
+
+#ifndef PARSER_HXX
+#define PARSER_HXX
+
+#include <string>
+#include <iosfwd>
+#include <memory> // std::auto_ptr
+
+#include <xercesc/dom/DOMDocument.hpp>
+
+#include <xsd/cxx/xml/dom/auto-ptr.hxx>
+
+class parser_impl;
+
+class parser
+{
+public:
+ ~parser ();
+ parser ();
+
+ // The start function returns a "carcase" of the complete document. That
+ // is, the root element with all the attributes but without any content.
+ //
+ xsd::cxx::xml::dom::auto_ptr<xercesc::DOMDocument>
+ start (std::istream& is, const std::string& id, bool validate);
+
+ // The next function returns next first-level element with all its
+ // attributes and content or 0 if no more available.
+ //
+ xsd::cxx::xml::dom::auto_ptr<xercesc::DOMDocument>
+ next ();
+
+private:
+ parser (const parser&);
+
+ parser&
+ operator= (const parser&);
+
+private:
+ std::auto_ptr<parser_impl> impl_;
+};
+
+#endif // PARSER_HXX