0023864: An & symbol is read incorrectly from a XML Ocaf file
[occt.git] / src / LDOM / LDOMParser.hxx
CommitLineData
b311480e 1// Created on: 2001-07-20
2// Created by: Alexander GRIGORIEV
3// Copyright (c) 2001-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
9//
10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12//
13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
20//AGV 060302: Input from istream
7fd59977 21
22#ifndef LDOMParser_HeaderFile
23#define LDOMParser_HeaderFile
24
25#include <LDOM_Document.hxx>
26#include <LDOM_OSStream.hxx>
27
28class LDOM_XmlReader;
29//class istream;
30
31// Class LDOMParser
32//
33
34class LDOMParser
35{
36 public:
37 // ---------- PUBLIC METHODS ----------
38
39 LDOMParser () : myReader (NULL), myCurrentData (16384) {}
40 // Empty constructor
41
42 virtual Standard_EXPORT ~LDOMParser ();
43 // Destructor
44
45 Standard_EXPORT LDOM_Document
46 getDocument ();
47 // Get the LDOM_Document
48
49 Standard_EXPORT Standard_Boolean
50 parse (const char * const aFileName);
51 // Parse a file
52 // Returns True if error occurred, then GetError() can be called
53
54 Standard_EXPORT Standard_Boolean
55 parse (istream& anInput);
56 // Parse a C++ stream
57 // Returns True if error occurred, then GetError() can be called
58
59 Standard_EXPORT const TCollection_AsciiString&
60 GetError (TCollection_AsciiString& aData) const;
61 // Return text describing a parsing error, or Empty if no error occurred
62
63 protected:
64 // ---------- PROTECTED METHODS ----------
65
66 Standard_EXPORT virtual Standard_Boolean
67 startElement ();
68 // virtual hook on 'StartElement' event for descendant classes
69
70 Standard_EXPORT virtual Standard_Boolean
71 endElement ();
72 // virtual hook on 'EndElement' event for descendant classes
73
74 Standard_EXPORT LDOM_Element
75 getCurrentElement () const;
76 // to be called from startElement() and endElement()
77
78 private:
79 // ---------- PRIVATE METHODS ----------
80 Standard_Boolean ParseDocument ();
81
82 Standard_Boolean ParseElement ();
83
84 // ---------- PRIVATE (PROHIBITED) METHODS ----------
85
86 LDOMParser (const LDOMParser& theOther);
87 // Copy constructor
88
89 LDOMParser& operator = (const LDOMParser& theOther);
90 // Assignment
91
92 private:
93 // ---------- PRIVATE FIELDS ----------
94
95 LDOM_XmlReader * myReader;
96 Handle(LDOM_MemManager) myDocument;
97 LDOM_OSStream myCurrentData;
98 TCollection_AsciiString myError;
99};
100
101#endif