[xsd-users] newly added node not in list?

Oliver.Kowalke at infineon.com Oliver.Kowalke at infineon.com
Tue Apr 11 02:17:51 EDT 2006


Hello,
the newly added c-node are not recognized if I iterate over the c-list
of node b_n?
In general how do I add text and embedded xml to a node which is of type
xsd:any?

regards,
Oliver

abc::a_type a_n( 
	* abc::a(
		path_,
		xml_schema::flags::keep_dom |
xml_schema::flags::dont_initialize) );

abc::a_type::b::container & b_n = a_n.b();
if ( b_n)
{
	xercesc::DOMElement * c_n = b_n->_node()
						->getOwnerDocument()
							->createElement(
	
xml::transcode< char >("c") );

c_n->appendChild(
		c_n->getOwnerDocument()
			->createTextNode( 
				xml::transcode< char >("XML Parsing
Tools") ) );

	b_n->_node()
	->appendChild( c_n); // c-tag added to b-tag -> list of c-tags

	abc::b_type::c::container::iterator i = b_n->c().begin();
	abc::b_type::c::container::iterator e = b_n->c().end();
				
	while ( i != e)
	{
		abc::c_type & c_n( * i);

		for (
			xercesc::DOMNode * child =
c_n._node()->getFirstChild();
			child != 0;
			child = child->getNextSibling() )
		{
			boost::mutex::scoped_lock lk( mtx_);

			if ( child->getNodeType() ==
xercesc::DOMNode::ELEMENT_NODE)
			{
				std::cout << xml::transcode< char >(
w->writeToString( * child) ) << std::endl;
				break;
			}
			else if ( child->getNodeType() ==
xercesc::DOMNode::TEXT_NODE)
				std::cout << xml::transcode< char >(
child->getNodeValue() ) << std::endl;	// not reached
			}

			++i;
		}
	}
}




More information about the xsd-users mailing list