You have to use xmlIOParseDTD
with an xmlParserInputBuffer
:
xmlParserInputBufferPtr buf = xmlParserInputBufferCreateMem(string, size, XML_CHAR_ENCODING_NONE);
xmlDtdPtr dtd = xmlIOParseDTD(NULL, buf, XML_CHAR_ENCODING_NONE);
xmlFreeParserInputBuffer(buf);
Replace XML_CHAR_ENCODING_NONE
with the appropriate encoding if your DTD doesn't contain a text declaration.