[xml] Problem with parsing of a beginner



Hi, when I see the system configure whith libxml2 2.5.7 and libxslt 1.0.30
in Solaris
5.8

      I don't know why the process always show me: "empty document". If I
use   if ((curX = xmlDocGetRootElement(doc)) == NULL) is rigth, but then
the xsl used don´t appears.

      Really, I want to parse a xml and ApplyStylesheet, then I want to get
then elemnts of the final xml.

      Here is the problem:
=============
   xmlSubstituteEntitiesDefault(1);
    xmlLoadExtDtdDefaultValue = 1;
    cur = xsltParseStylesheetFile((const xmlChar *)argv[i]);
    i++;
    doc = xmlParseFile(argv[i]);
    res = xsltApplyStylesheet(cur, doc, params);

    xsltSaveResultToFile(stdout, res, cur);

    /* Una vez parseado ... */
    if ((curX = xmlDocGetRootElement(res)) == NULL)
    {
        printf("empty document\n");
        xmlFreeDoc(res);
        return(0);
    }

     printf("%s\n", curX->name);
===============


Thank you very much.

Sergio Soriano.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]