Re: [libxml++] NodeList problem.
- From: Darko Miletic <darko uvcms com>
- To: m smart sympatico ca
- Cc: libxmlplusplus-general lists sourceforge net
- Subject: Re: [libxml++] NodeList problem.
- Date: Tue, 07 Jun 2005 16:14:41 -0300
m smart sympatico ca wrote:
Hi, I have am trying to use your API with MSVC71. Most things seem to work okay, but when I have a line of code like the following:
const xmlpp::Node::NodeList& m_nodeList = root->get_children();
xmlpp::Node::NodeList::const_iterator itr = m_nodeList.begin();
After running my program through a debugger, I found that it's when m_nodeList.begin() is called that the problem arises. I can make calls to m_nodeList.size() and empty() without a problem, it's just the begin one. The error I get is "The application has requested the runtime to terminate in an unusual way..."
Does anyone know what I am doing wrong? Thanks in advance for any help,
You do it wrong. get_children return a list container that should
contain all children elements. However if there is no children of that
node get_children returns empty list. You must check if list contains
something. You can do it like this:
xmlpp::Node::NodeList nl = node->get_children();
if ( !nl.empty() ) {
xmlpp::Node::NodeList::iterator it = nl.begin();
//other code here
}
Darko
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]