src/XMLDocumentConstructor.h
branchv_0
changeset 2 4b938619848b
parent 1 db5418b04c63
equal deleted inserted replaced
1:db5418b04c63 2:4b938619848b
    56 				if (parent == nullptr) {
    56 				if (parent == nullptr) {
    57 					element = document->create_root_node(elementName);
    57 					element = document->create_root_node(elementName);
    58 				} else {
    58 				} else {
    59 					element = parent->add_child(elementName);
    59 					element = parent->add_child(elementName);
    60 				}
    60 				}
    61 
    61 				
    62 				for (size_t i = 0; i < htmlNode->v.element.attributes.length; i++) {
    62 				for (size_t i = 0; i < htmlNode->v.element.attributes.length; i++) {
       
    63 					// FIXME: if the xmlns was set in exportTo() according to the DOCTYPE, we should not add xmlns attribute here (otherwise we would have two xmlns attributes and thus invalid xml)
    63 					GumboAttribute* htmlAttribute = static_cast<GumboAttribute*> (htmlNode->v.element.attributes.data[i]);
    64 					GumboAttribute* htmlAttribute = static_cast<GumboAttribute*> (htmlNode->v.element.attributes.data[i]);
    64 					element->set_attribute(htmlAttribute->name, htmlAttribute->value);
    65 					element->set_attribute(htmlAttribute->name, htmlAttribute->value);
    65 				}
    66 				}
    66 
    67 
    67 				for (size_t i = 0; i < htmlNode->v.element.children.length; i++) {
    68 				for (size_t i = 0; i < htmlNode->v.element.children.length; i++) {