Hi,

 

I am using the libXML to my load xml file. I am using the windows
version 

of the libXML, which I downloaded from
http://www.zlatkovic.com/libxml.en.html.

I call the same function recursively to load the parent and alias xml
files. I call this function

when an event occurs on a thread. The program crashes when I call
xmlReaderForFile 

for an alias in the main xml file. I mean it loads the parent xml
successfully having the same alias xml,

but when it loads the alias for the main xml file it crashes.. COULD
SOMEONE PLEASE HELP ME..

 

Code Snippet

===========

 

void loadConfiguration(string urlStr) 

{

xmlInitParser(); 

      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) 

      {

            int ret = xmlTextReaderRead(reader);

if (ret == 1) 

      {

                  processNode(reader);

                  xmlChar* parentURI = getAttribute(reader,
(xmlChar*)"parent");

            if (loadParentAlso && parentURI) 

{

                        _parentConfigName = string((const
char*)parentURI);

loadConfiguration(_parentConfigName));

            }

                  xmlChar* aliasURI = getAttribute(reader,
(xmlChar*)"alias");

            if (loadParentAlso && parentURI) 

{

                        _aliasName = string((const char*)parentURI);

loadConfiguration(_aliasName));

            }

 }

      }

 

      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/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to