summaryrefslogtreecommitdiff
path: root/examples/cxx/tree/streaming/parser.hxx
blob: 000d0221c702bd6443594c1490d59d314927be20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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