|
From: Matthias W. <m...@tt...> - 2006-11-07 23:01:20
|
Hi list,
I have tracked down a bug I have in some code, that uses libxml++, and I
am not sure if I found a bug in libxml++, or if I just expect the wrong
behaviour from this library.
The problem I have with libxml++ can be shown with the following code:
>>>>>>>>
xmlpp::Document* xml_document = new xmlpp::Document;
xmlpp::Element* root_element = xml_document->create_root_node("stream",
"http://etherx.jabber.org/streams", "stream");
root_element->set_namespace_declaration("jabber:server");
root_element->set_attribute("version", "1.0");
root_element->set_attribute("to", "example.com");
xmlpp::Element* message_element = root_element->add_child("message");
std::cout << "The namespace IRI of the message element is: '"
<< message_element->get_namespace_uri() << "'" << std::endl;
>>>>>>>>
The output I get from this code is:
The namespace IRI of the message element is: ''
... but what I expected to get was:
The namespace IRI of the message element is: 'jabber:server'
When I serialize the document using the write_to_stream() method of
Document, I correctly get the message element inside the namespace
"jabber:server". But why then does the get_namespace_uri() method for
this element return an empty string?
Tot kijk
Matthias
|