diff -r db5418b04c63 -r 4b938619848b src/XMLDocumentConstructor.h --- a/src/XMLDocumentConstructor.h Sun Feb 21 22:11:49 2021 +0100 +++ b/src/XMLDocumentConstructor.h Sun Feb 21 23:52:46 2021 +0100 @@ -58,8 +58,9 @@ } else { element = parent->add_child(elementName); } - + for (size_t i = 0; i < htmlNode->v.element.attributes.length; i++) { + // 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) GumboAttribute* htmlAttribute = static_cast (htmlNode->v.element.attributes.data[i]); element->set_attribute(htmlAttribute->name, htmlAttribute->value); }