[DEV] rework compleate

This commit is contained in:
Edouard DUPIN 2016-04-19 21:46:51 +02:00
parent 0e507add7e
commit c5589ebc8f
3 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,8 @@ exml::Element::Element(ememory::SharedPtr<exml::internal::Node> _internalNode) :
if (m_data == nullptr) {
return;
}
if (m_data->isElement() == false) {
if ( m_data->isElement() == false
&& m_data->isDocument() == false) {
// try to set wrong type inside ... ==> remove it ...
m_data = nullptr;
}

View File

@ -156,7 +156,7 @@ bool exml::Node::isElement() const {
if (m_data == nullptr) {
return false;
}
return m_data->isElement();
return m_data->isElement() || m_data->isDocument();
}
bool exml::Node::isText() const {

View File

@ -24,7 +24,7 @@ void appl::read() {
TEST_INFO(" " << it);
}
TEST_INFO("list of sub-node:");
for (const auto it: doc) {
for (const auto it: doc.nodes) {
TEST_INFO(" " << it);
if (it.isElement() == false) {
continue;
@ -38,7 +38,7 @@ void appl::read() {
TEST_INFO(" " << itElem);
}
TEST_INFO(" list of sub-node:");
for (const auto itElem: elem) {
for (const auto itElem: elem.nodes) {
TEST_INFO(" " << itElem);
}
}