add reopen the existed memory in lightreader

This commit is contained in:
Oleg Korshul
2020-07-17 13:43:51 +03:00
parent 38a9bc9175
commit e4bb008fa5
3 changed files with 18 additions and 0 deletions

View File

@ -95,6 +95,8 @@ namespace XmlUtils
bool FromString (const std::wstring& sXml);
bool FromStringA(const std::string& sXml);
bool MoveToStart();
bool Read(XmlNodeType &oNodeType);
bool ReadNextNode();
bool ReadNextSiblingNode(int nDepth);

View File

@ -111,6 +111,10 @@ namespace XmlUtils
{
return m_pInternal->FromStringA(sXml);
}
bool CXmlLiteReader::MoveToStart()
{
return m_pInternal->MoveToStart();
}
bool CXmlLiteReader::Read(XmlNodeType &oNodeType)
{

View File

@ -130,6 +130,18 @@ namespace XmlUtils
return true;
}
inline bool MoveToStart()
{
if (NULL != reader)
xmlFreeTextReader(reader);
if (NULL == m_pStream)
return false;
reader = xmlReaderForMemory((char*)m_pStream, m_lStreamLen, NULL, NULL, 0);
return true;
}
inline bool Read(XmlNodeType &oNodeType)
{
if (!IsValid())