| 13265 | */ |
| 13266 | |
| 13267 | xmlDocPtr |
| 13268 | xmlSAXParseDoc(xmlSAXHandlerPtr sax, const xmlChar *cur, int recovery) { |
| 13269 | xmlDocPtr ret; |
| 13270 | xmlParserCtxtPtr ctxt; |
| 13271 | xmlSAXHandlerPtr oldsax = NULL; |
| 13272 | |
| 13273 | if (cur == NULL) return(NULL); |
| 13274 | |
| 13275 | |
| 13276 | ctxt = xmlCreateDocParserCtxt(cur); |
| 13277 | if (ctxt == NULL) return(NULL); |
| 13278 | if (sax != NULL) { |
| 13279 | oldsax = ctxt->sax; |
| 13280 | ctxt->sax = sax; |
| 13281 | ctxt->userData = NULL; |
| 13282 | } |
| 13283 | |
| 13284 | xmlParseDocument(ctxt); |
| 13285 | if ((ctxt->wellFormed) || recovery) ret = ctxt->myDoc; |
| 13286 | else { |
| 13287 | ret = NULL; |
| 13288 | xmlFreeDoc(ctxt->myDoc); |
| 13289 | ctxt->myDoc = NULL; |
| 13290 | } |
| 13291 | if (sax != NULL) |
| 13292 | ctxt->sax = oldsax; |
| 13293 | xmlFreeParserCtxt(ctxt); |
| 13294 | |
| 13295 | return(ret); |
| 13296 | } |
| 13297 | |
| 13298 | /** |
| 13299 | * xmlParseDoc: |
no test coverage detected