1 // Created on: 2001-07-20
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
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.
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.
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.
20 //AGV 060302: Input from istream
21 // AGV 130302: bug corr: was error if strlen(root_elem_name) < 7
23 #ifndef LDOM_XmlReader_HeaderFile
24 #define LDOM_XmlReader_HeaderFile
26 //#define XML_BUFFER_SIZE 1000
27 #define XML_BUFFER_SIZE 20480
29 #include <LDOM_BasicElement.hxx>
31 class TCollection_AsciiString;
34 // Class LDOM_XmlReader
53 // ---------- PUBLIC METHODS ----------
54 LDOM_XmlReader (const int aFileDes, const Handle(LDOM_MemManager)& aDocument,
55 TCollection_AsciiString& anErrorString);
56 // Constructor - takes a file descriptor for input
58 LDOM_XmlReader (istream& anInput, const Handle(LDOM_MemManager)& aDocument,
59 TCollection_AsciiString& anErrorString);
60 // Constructor - takes an istream for input
62 RecordType ReadRecord (LDOM_OSStream& theData);
63 // reading a markup or other element of XML format
65 LDOM_BasicElement& GetElement () const { return * myElement; }
66 // get the last element retrieved from the stream
68 static Standard_Boolean getInteger (LDOMBasicString& theValue,
69 const char * theStart,
71 // try convert string theStart to LDOM_AsciiInteger, return False on success
74 // ---------- PRIVATE (PROHIBITED) METHODS ----------
75 LDOM_XmlReader (const LDOM_XmlReader& theOther);
78 LDOM_XmlReader& operator = (const LDOM_XmlReader& theOther);
82 // ---------- PRIVATE FIELDS ----------
84 Standard_Boolean myEOF;
85 int myFileDes; // alternative 1: file descriptor
86 istream& myIStream; // alternative 2: istream
87 TCollection_AsciiString & myError;
88 Handle(LDOM_MemManager) myDocument;
89 LDOM_BasicElement * myElement;
90 const LDOM_BasicNode * myLastChild; // optim. reading attributes
92 const char * myEndPtr;
93 char myBuffer [XML_BUFFER_SIZE+4];