1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027077: OCAF: Implementation of streaming save/load (OCC26229) is incomplete/incorrect

XmlOcaf reading is non-seekable

// 1. Read method of XmlLDrivers_DocumentRetrievalDriver extended to read complete document (with "document" tag) in compatible mode (when reading is performed from file)
// 2. the empty statement removed
// 3. the description of LDOMPARSER::parse method extended
This commit is contained in:
ibs
2016-01-14 19:17:00 +03:00
committed by bugmaster
parent 3f8122493a
commit 5fce160515
8 changed files with 102 additions and 44 deletions

View File

@@ -93,19 +93,10 @@ PCDM_TypeOfFileDriver PCDM::FileDriverType (Standard_IStream& theIStream, PCDM_B
{
TCollection_AsciiString aReadMagicNumber;
// read magic number from the file
if (theIStream.good())
{
streampos aDocumentPos = theIStream.tellg();
// read magic number from the file
aReadMagicNumber = Storage_BaseDriver::ReadMagicNumber (theIStream);
if (!theIStream.good())
{
theIStream.clear();
}
theIStream.seekg(aDocumentPos);
}
if(aReadMagicNumber == FSD_CmpFile::MagicNumber())
@@ -123,6 +114,17 @@ PCDM_TypeOfFileDriver PCDM::FileDriverType (Standard_IStream& theIStream, PCDM_B
theBaseDriver = new FSD_BinaryFile;
return PCDM_TOFD_File;
}
else if (aReadMagicNumber.Search ("<?xml") != -1)
{
// skip xml declaration
char aChar = ' ';
while (theIStream.good() && !theIStream.eof() && aChar != '>')
{
theIStream.get(aChar);
}
return PCDM_TOFD_XmlFile;
}
theBaseDriver = NULL;
return PCDM_TOFD_Unknown;