[In] attribute


new string(sbyteValue) because its null terminated.[In]new string(sbyteValue) [DllImport(s_LibraryName, CallingConvention = s_CallConv, EntryPoint = "XML_ErrorString")]
static extern XML_Char* _GetErrorString(Error error);[TestMethod]
[DataRow("<foo xmlns='bar'/>")]
[DataRow("<foo xmlns='baz'><bar/></foo>")]
[DataRow("<foo xmlns='baz'><bar>content node</bar></foo>")]
[DataRow("<foo xmlns='baz'><!-- a comment --></foo>")]
[DataRow("<foo xmlns='baz'><![CDATA[ a data ]]></foo>")]
[DataRow("<foo xmlns='bar'/>")]
[DataRow("<foo xmlns='baz'><bar/><!-- a comment --></foo>")]
[DataRow("<foo xmlns='baz'><bar>content node</bar><![CDATA[ a data ]]></foo>")]
public void ParseFromString(string xml)
{
var buf = new byte[4];
var cnt = 0;
using var ms = new MemoryStream();
ms.Write(Encoding.UTF8.GetBytes(xml));
ms.Position = 0;
using var parser = new ExpatParser();
// simulate long I/O operation (eg: network socket)
while ((cnt = ms.Read(buf)) > 0)
{
parser.Write(buf, cnt, false);
}
parser.Write(buf, 0, true);
}