Hi,

I'm doing a program that is responsible for parsing large xml files, so I
need to do many function invocations xsltParseStylesheetFile using an
iterative cycle depending on the case because I use a particular xsl file to
generate another xml file.

Within the iterative cycle, when I invoke for the first time
xsltParseStylesheetFile function runs fine but after the second time he
throws the following error: 16526 Segmentation Fault (coredump).

Here I show a segment of the code I'm running:

while (true){

TransformXMLMassive(xxx,xxx,xxxx,xxx);

}

char *TransformXMLMassive(char *UrlXmlInput, char *UrlXslInput, const char
*Params[], char *UrlXmlOutput){

    FILE *FileOutput;
    xmlDocPtr doc, res;
    xmlLoadExtDtdDefaultValue = 1;
    xsltStylesheetPtr cur = NULL;

    xmlInitParser();
    xmlSubstituteEntitiesDefault(1);
    cur = xsltParseStylesheetFile((const xmlChar *)UrlXslInput);
    doc = xmlParseFile(UrlXmlInput);
    res = xsltApplyStylesheet(cur, doc, Params);

    if((FileOutput = fopen(UrlXmlOutput, "a+t")) == NULL) {
        xsltFreeStylesheet(cur);
        xmlFreeDoc(res);
        xmlFreeDoc(doc);
        xsltCleanupGlobals();
        xmlCleanupParser();
    }

    xsltSaveResultToFile(FileOutput, res, cur);

    fclose(FileOutput);
    xsltFreeStylesheet(cur);
    xmlFreeDoc(res);
    xmlFreeDoc(doc);
    xmlCleanupParser();
    xsltCleanupGlobals();
    xmlMemoryDump();

}


I would appreciate any help you can provide.


Regards,
_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
xslt@gnome.org
https://mail.gnome.org/mailman/listinfo/xslt

Reply via email to