1 // Created on: 2001-07-20
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //AGV 060302: Input from istream
18 #ifndef LDOMParser_HeaderFile
19 #define LDOMParser_HeaderFile
21 #include <LDOM_Document.hxx>
22 #include <LDOM_OSStream.hxx>
33 // ---------- PUBLIC METHODS ----------
35 LDOMParser () : myReader (NULL), myCurrentData (16384) {}
38 virtual Standard_EXPORT ~LDOMParser ();
41 Standard_EXPORT LDOM_Document
43 // Get the LDOM_Document
45 Standard_EXPORT Standard_Boolean
46 parse (const char * const aFileName);
48 // Returns True if error occurred, then GetError() can be called
50 Standard_EXPORT Standard_Boolean
51 parse (istream& anInput);
53 // Returns True if error occurred, then GetError() can be called
55 Standard_EXPORT const TCollection_AsciiString&
56 GetError (TCollection_AsciiString& aData) const;
57 // Return text describing a parsing error, or Empty if no error occurred
60 // ---------- PROTECTED METHODS ----------
62 Standard_EXPORT virtual Standard_Boolean
64 // virtual hook on 'StartElement' event for descendant classes
66 Standard_EXPORT virtual Standard_Boolean
68 // virtual hook on 'EndElement' event for descendant classes
70 Standard_EXPORT LDOM_Element
71 getCurrentElement () const;
72 // to be called from startElement() and endElement()
75 // ---------- PRIVATE METHODS ----------
76 Standard_Boolean ParseDocument (Standard_IStream& theIStream);
78 Standard_Boolean ParseElement (Standard_IStream& theIStream);
80 // ---------- PRIVATE (PROHIBITED) METHODS ----------
82 LDOMParser (const LDOMParser& theOther);
85 LDOMParser& operator = (const LDOMParser& theOther);
89 // ---------- PRIVATE FIELDS ----------
91 LDOM_XmlReader * myReader;
92 Handle(LDOM_MemManager) myDocument;
93 LDOM_OSStream myCurrentData;
94 TCollection_AsciiString myError;