diff --git a/manifest_xml.py b/manifest_xml.py
index 03925176..0068ac6a 100644
--- a/manifest_xml.py
+++ b/manifest_xml.py
@@ -1266,7 +1266,10 @@ https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
raise ManifestParseError("no root node in %s" % (path,))
for manifest in root.childNodes:
- if manifest.nodeName == "manifest":
+ if (
+ manifest.nodeType == manifest.ELEMENT_NODE
+ and manifest.nodeName == "manifest"
+ ):
break
else:
raise ManifestParseError("no in %s" % (path,))
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py
index 1015e114..bd255dcc 100644
--- a/tests/test_manifest_xml.py
+++ b/tests/test_manifest_xml.py
@@ -385,6 +385,21 @@ class XmlManifestTests(ManifestParseTestCase):
"",
)
+ def test_parse_with_xml_doctype(self):
+ """Check correct manifest parse with DOCTYPE node present."""
+ manifest = self.getXmlManifest(
+ """
+
+
+
+
+
+
+"""
+ )
+ self.assertEqual(len(manifest.projects), 1)
+ self.assertEqual(manifest.projects[0].name, "test-project")
+
class IncludeElementTests(ManifestParseTestCase):
"""Tests for ."""