Re: [libxml++] NodeList problem.
- From: Darko Miletic <darko uvcms net>
- To: m smart sympatico ca
- Cc: libxmlplusplus-general lists sourceforge net
- Subject: Re: [libxml++] NodeList problem.
- Date: Thu, 09 Jun 2005 18:43:52 -0300
m smart sympatico ca wrote:
Even if I call the function like so:
root->get_children().begin()
I get the violation. And no, if I reference to the list, it is not invalid and .begin() should still be callable. It is the deferenceing it that will call the problem. The reference is the same as making a nodelist pointer that points to root->get_children() and calling ->begin() on it. I don't see how that should invalidate anything.
Now that is strange. I tried this micro code and no exception occured.
#include <iostream>
#include <string>
#include <libxml++/libxml++.h>
int main(int argc, char* argv[]) {
try {
if (argc > 1) {
xmlpp::DomParser parser(argv[1], false);
xmlpp::Element* root = parser.get_document()->get_root_node();
if (NULL != root) {
const xmlpp::Node::NodeList& nlist = root->get_children();
xmlpp::Node::NodeList::const_iterator itr = nlist.begin();
}
else {
std::cout << "No root node!" << std::endl;
}
}
else {
std::cout << "Specify filename please" << std::endl;
}
}
catch (const std::exception& e){
std::cerr << e.what() << std::endl;
return -1;
}
return 0;
}
And using sample xml as input parameter with this content
<?xml version="1.0"?>
<!DOCTYPE root>
<root>
<child>
<grandchildren>
</grandchildren>
</child>
</root>
I tested this with Borland Free Compiler 5.5.1 and with vc 2005 beta 1
compilers.
libxml++ version 1.0.4
Compilers where using multithreaded dynamic RTL.
Could you please verify that this does or does not work in your case?
Darko
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]