[xml] validation & xpath



Hello,

I'm trying to use XPath with libxml2 and I came accross a strange behavior which I do not understand:

Here a summary of the parsing of my doc and the XPath evaluation:

I took the code sometime ago from the "xmlCreateURLParserCtxt( const char* filename , int options )"


    xmlParserCtxtPtr ctxt;
    xmlParserInputPtr inputStream;
    char *directory = NULL;

    ctxt->_private = this;
    ctxt->sax->serror = libxml2_gcdk_error_handler_adapter;
    ctxt->linenumbers = 1;
    ctxt->replaceEntities = 1;

    ctxt->validate = 0;

    inputStream = NULL;
    inputStream = xmlLoadExternalEntity(p_filename, NULL, ctxt);

    inputPush(ctxt, inputStream);
    if ((ctxt->directory == NULL) && (directory == NULL))
            directory = xmlParserGetDirectory(p_filename);
    if ((ctxt->directory == NULL) && (directory != NULL))
            ctxt->directory = directory;

    ctxt->validate = 1;
    xmlParseDocument( ctxt );

 

And it seems that in this case, my XPath expressions does not gave any result node, while when I initialize ctxt->validate to 0, It gave me the good results.

Is there anyone who could explain me what I'm doing wrong please ?

Thanks you all

 



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