diff options
-rw-r--r-- | manifest_xml.py | 5 | ||||
-rw-r--r-- | tests/test_manifest_xml.py | 15 |
2 files changed, 19 insertions, 1 deletions
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 | |||
1266 | raise ManifestParseError("no root node in %s" % (path,)) | 1266 | raise ManifestParseError("no root node in %s" % (path,)) |
1267 | 1267 | ||
1268 | for manifest in root.childNodes: | 1268 | for manifest in root.childNodes: |
1269 | if manifest.nodeName == "manifest": | 1269 | if ( |
1270 | manifest.nodeType == manifest.ELEMENT_NODE | ||
1271 | and manifest.nodeName == "manifest" | ||
1272 | ): | ||
1270 | break | 1273 | break |
1271 | else: | 1274 | else: |
1272 | raise ManifestParseError("no <manifest> in %s" % (path,)) | 1275 | raise ManifestParseError("no <manifest> 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): | |||
385 | "</manifest>", | 385 | "</manifest>", |
386 | ) | 386 | ) |
387 | 387 | ||
388 | def test_parse_with_xml_doctype(self): | ||
389 | """Check correct manifest parse with DOCTYPE node present.""" | ||
390 | manifest = self.getXmlManifest( | ||
391 | """<?xml version="1.0" encoding="UTF-8"?> | ||
392 | <!DOCTYPE manifest []> | ||
393 | <manifest> | ||
394 | <remote name="test-remote" fetch="http://localhost" /> | ||
395 | <default remote="test-remote" revision="refs/heads/main" /> | ||
396 | <project name="test-project" path="src/test-project"/> | ||
397 | </manifest> | ||
398 | """ | ||
399 | ) | ||
400 | self.assertEqual(len(manifest.projects), 1) | ||
401 | self.assertEqual(manifest.projects[0].name, "test-project") | ||
402 | |||
388 | 403 | ||
389 | class IncludeElementTests(ManifestParseTestCase): | 404 | class IncludeElementTests(ManifestParseTestCase): |
390 | """Tests for <include>.""" | 405 | """Tests for <include>.""" |