| 859 | */ |
| 860 | |
| 861 | xmlDocPtr |
| 862 | xmlParseCatalogFile(const char *filename) { |
| 863 | xmlDocPtr ret; |
| 864 | xmlParserCtxtPtr ctxt; |
| 865 | xmlParserInputPtr inputStream; |
| 866 | xmlParserInputBufferPtr buf; |
| 867 | |
| 868 | ctxt = xmlNewParserCtxt(); |
| 869 | if (ctxt == NULL) { |
| 870 | xmlCatalogErrMemory(); |
| 871 | return(NULL); |
| 872 | } |
| 873 | |
| 874 | buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); |
| 875 | if (buf == NULL) { |
| 876 | xmlFreeParserCtxt(ctxt); |
| 877 | return(NULL); |
| 878 | } |
| 879 | |
| 880 | inputStream = xmlNewInputStream(ctxt); |
| 881 | if (inputStream == NULL) { |
| 882 | xmlFreeParserInputBuffer(buf); |
| 883 | xmlFreeParserCtxt(ctxt); |
| 884 | return(NULL); |
| 885 | } |
| 886 | |
| 887 | inputStream->filename = (char *) xmlCanonicPath((const xmlChar *)filename); |
| 888 | inputStream->buf = buf; |
| 889 | xmlBufResetInput(buf->buffer, inputStream); |
| 890 | |
| 891 | inputPush(ctxt, inputStream); |
| 892 | |
| 893 | ctxt->valid = 0; |
| 894 | ctxt->validate = 0; |
| 895 | ctxt->loadsubset = 0; |
| 896 | ctxt->pedantic = 0; |
| 897 | ctxt->dictNames = 1; |
| 898 | |
| 899 | xmlParseDocument(ctxt); |
| 900 | |
| 901 | if (ctxt->wellFormed) |
| 902 | ret = ctxt->myDoc; |
| 903 | else { |
| 904 | ret = NULL; |
| 905 | xmlFreeDoc(ctxt->myDoc); |
| 906 | ctxt->myDoc = NULL; |
| 907 | } |
| 908 | xmlFreeParserCtxt(ctxt); |
| 909 | |
| 910 | return(ret); |
| 911 | } |
| 912 | |
| 913 | /** |
| 914 | * xmlLoadFileContent: |
no test coverage detected