私のコードは次の文字列を生成します。
XmlWriter obj1;
obj1.StartDocWriting("MyObject.xml");
obj1.SetRootNode("Object");
obj1.CreateChildNodeToRootWithProperty("age","20");
obj1.CreateChildNodeToRootWithProperty("name","xyz");
obj1.xml_to_string(outbuf);
o/p xml 文字列、
<?xml version="1.0"?>
<Object><age>20</age><name>xyz</name></Object>
解析しようとすると、次のエラーが表示されます。
エンティティ: 3 行目: パーサー エラー: ドキュメントの末尾に余分なコンテンツがあります
Here is my parsing code,
std:string inbuf = "<?xml version="1.0"?>
<Object><age>20</age><name>xyz</name></Object>"
XmlTextReader obj1;
xmlTextReaderPtr readPtr = obj1.parseBuffer(inbuf.c_str(),10000);
xmlTextReaderPtr XmlTextReader::parseBuffer( const char *aInBuffer,
int aInSize,
const char * aInUrl,
const char * aInEncoding,
int aInOptions )
{
xmlReader = xmlReaderForMemory( aInBuffer, aInSize, aInUrl, aInEncoding, aInOptions );
if( xmlReader == NULL )
{
printf("reader is null");
// LOG(LOG_INFO, "parseBuffer:: xmlReaderForMemory return NULL\n");
}
return xmlReader;
}