Re: [xml] xmlReaderForFile Crashes.. Need immediate help..




Jayashree,

Here is a link about using libxml2 in threads: http://www.xmlsoft.org/threads.html

I think if you call xmlInitParser() in main before creating your thread you will be ok, otherwise your sample looks ok.

Thanks,

Jim



"Kali, Jayashree" <jayashree kali wachovia com>
Sent by: xml-bounces gnome org

02/27/2007 02:40 PM

To
<xml gnome org>
cc
Subject
[xml] xmlReaderForFile Crashes.. Need immediate help..





Hi,
 
I am using the libXML to my xml file. I am using the windows version
of the libXML, which I downloaded from http://www.zlatkovic.com/libxml.en.html.
When I use the libXML function âxmlReaderForFileâ in a thread apart from
my main thread, it crashes. The function is not called concurrently too.
The below is the code snippet which crashes. Is there anyway I can fix the crash?
Any help would be greatly appritiated.
 
Regards,
Jayashree
 
Code Snippet
===========
 
void loadConfiguration(string urlStr)
{
      xmlTextReaderPtr reader = NULL;
      // XML_PARSE_NOCDATA, docs say it merges CDATA into #text.
      reader = xmlReaderForFile(urlStr.c_str(), NULL, XML_PARSE_NOENT | XML_PARSE_NOCDATA);
      if (reader)
      {
            cout<<"SUCESS..."<<endl<<endl;
      }
 
      xmlFreeTextReader(reader);
}
 
void loadConfig(void *pData)
{
      loadConfiguration("sampleApp.xml");
}
 
int _tmain(int argc, _TCHAR* argv[])
{
      loadConfiguration("sampleApp.xml");
      _beginthread( loadConfig, 0, NULL );
 
      getch();
      return 0;
}
 _______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml



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