XmlLite questions:
I am using XmlLite (the reader) to parse some XML fragments, and I have a few questions.
Example fragment:
<Top>
<Second>
<Data>
<Top>
</Top>
</Data>
</Second>
</Top>
1. How can I determine when I am finish parsing?
I have tried using the GetDepth() to determine when finish, but I am not clear on the meaning, since
the depth can change when reading attributes. I also do not know exactly when the depth is changed.
2. I use CreateStreamOnHGlobal to create a stream used for IXmlWriter. When finish with IXmlWriter
calls, I return the XML data in a CStringA by using:
// Get the size of the stream.
ULONG nRead;
ULONG nSize;
STATSTG oStatus;
hr = m_pMemoryStream->Stat(&oStatus, STATFLAG_DEFAULT);
nSize = (ULONG)oStatus.cbSize.LowPart ;
// Go to the beginning of the stream.
hr = RewindStream();
assert(SUCCEEDED(hr));
// Read the XML formatted data.
hr = m_pMemoryStream->Read(sBuffer.GetBuffer(nSize), nSize, &nRead);
sBuffer.ReleaseBuffer();
However, it seems the size of the stream may be greater than the size of the XML written. How can I
determine the number of bytes written by IXmlWriter?
--
Frank