MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlIOParseDTD

Function xmlIOParseDTD

ThirdParty/libxml2/vtklibxml2/parser.c:11821–11897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11819 */
11820
11821xmlDtdPtr
11822xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
11823 xmlCharEncoding enc) {
11824 xmlDtdPtr ret = NULL;
11825 xmlParserCtxtPtr ctxt;
11826 xmlParserInputPtr pinput = NULL;
11827
11828 if (input == NULL)
11829 return(NULL);
11830
11831 ctxt = xmlNewSAXParserCtxt(sax, NULL);
11832 if (ctxt == NULL) {
11833 xmlFreeParserInputBuffer(input);
11834 return(NULL);
11835 }
11836 xmlCtxtSetOptions(ctxt, XML_PARSE_DTDLOAD);
11837
11838 /*
11839 * generate a parser input from the I/O handler
11840 */
11841
11842 pinput = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
11843 if (pinput == NULL) {
11844 xmlFreeParserInputBuffer(input);
11845 xmlFreeParserCtxt(ctxt);
11846 return(NULL);
11847 }
11848
11849 /*
11850 * plug some encoding conversion routines here.
11851 */
11852 if (xmlPushInput(ctxt, pinput) < 0) {
11853 xmlFreeParserCtxt(ctxt);
11854 return(NULL);
11855 }
11856 if (enc != XML_CHAR_ENCODING_NONE) {
11857 xmlSwitchEncoding(ctxt, enc);
11858 }
11859
11860 /*
11861 * let's parse that entity knowing it's an external subset.
11862 */
11863 ctxt->myDoc = xmlNewDoc(BAD_CAST "1.0");
11864 if (ctxt->myDoc == NULL) {
11865 xmlErrMemory(ctxt);
11866 return(NULL);
11867 }
11868 ctxt->myDoc->properties = XML_DOC_INTERNAL;
11869 ctxt->myDoc->extSubset = xmlNewDtd(ctxt->myDoc, BAD_CAST "none",
11870 BAD_CAST "none", BAD_CAST "none");
11871
11872 xmlParseExternalSubset(ctxt, BAD_CAST "none", BAD_CAST "none");
11873
11874 if (ctxt->myDoc != NULL) {
11875 if (ctxt->wellFormed) {
11876 ret = ctxt->myDoc->extSubset;
11877 ctxt->myDoc->extSubset = NULL;
11878 if (ret != NULL) {

Callers

nothing calls this directly

Calls 12

xmlNewSAXParserCtxtFunction · 0.85
xmlFreeParserInputBufferFunction · 0.85
xmlCtxtSetOptionsFunction · 0.85
xmlNewIOInputStreamFunction · 0.85
xmlFreeParserCtxtFunction · 0.85
xmlPushInputFunction · 0.85
xmlSwitchEncodingFunction · 0.85
xmlNewDocFunction · 0.85
xmlErrMemoryFunction · 0.85
xmlNewDtdFunction · 0.85
xmlParseExternalSubsetFunction · 0.85
xmlFreeDocFunction · 0.85

Tested by

no test coverage detected