diff --git a/lib/Parser/TreeConstructor.php b/lib/Parser/TreeConstructor.php index 556b24d..119e736 100644 --- a/lib/Parser/TreeConstructor.php +++ b/lib/Parser/TreeConstructor.php @@ -4236,9 +4236,9 @@ class TreeConstructor { // NOTE: The specification is silent as to how to handle these // attributes. We assume these bad attributes should be dropped, // since they break the DOM when added - if ($attr->name === "xmlns" && $namespace !== null && $attr->value !== $namespace) { + if ($attr->name === "xmlns" && $namespace !== $this->htmlNamespace && $attr->value !== $namespace) { $this->error(ParseError::INVALID_NAMESPACE_ATTRIBUTE_VALUE, "xmlns", $namespace); - } elseif ($attr->name === "xmlns:xlink" && $namespace !== null && $attr->value !== Parser::XLINK_NAMESPACE) { + } elseif ($attr->name === "xmlns:xlink" && $namespace !== $this->htmlNamespace && $attr->value !== Parser::XLINK_NAMESPACE) { $this->error(ParseError::INVALID_NAMESPACE_ATTRIBUTE_VALUE, "xmlns:xlink", Parser::XLINK_NAMESPACE); } else { $this->elementSetAttribute($element, $attr->namespace, $attr->name, $attr->value); diff --git a/tests/cases/TestTreeConstructor.php b/tests/cases/TestTreeConstructor.php index 3e5eae5..d22f933 100644 --- a/tests/cases/TestTreeConstructor.php +++ b/tests/cases/TestTreeConstructor.php @@ -140,8 +140,6 @@ class TestTreeConstructor extends \PHPUnit\Framework\TestCase { for ($a = 0; $a < sizeof($exp); $a++) { if (preg_match('/^\|\s+xmlns xmlns=/', $exp[$a])) { $exp[$a] = preg_replace('/^\|(\s+)xmlns xmlns=/', "|$1xmlns=", $exp[$a]); - } elseif (preg_match('/^\|\s+xmlns=/', $exp[$a])) { - $this->markTestSkipped(); } } } diff --git a/tests/cases/tree-construction/mensbeam01.dat b/tests/cases/tree-construction/mensbeam01.dat index 08a8f66..0e5d69d 100644 --- a/tests/cases/tree-construction/mensbeam01.dat +++ b/tests/cases/tree-construction/mensbeam01.dat @@ -66,3 +66,13 @@ | xml id="proper" |

| xml:id="bogus" + +#data + +#errors +#document +| +| +| xmlns="ook" +| +| diff --git a/tests/cases/tree-construction/mensbeam03.dat b/tests/cases/tree-construction/mensbeam03.dat index cdbf751..83953c5 100644 --- a/tests/cases/tree-construction/mensbeam03.dat +++ b/tests/cases/tree-construction/mensbeam03.dat @@ -143,13 +143,3 @@ table | | | "X" - -#data - -#errors -#document -| -| -| xmlns="ook" -| -| \ No newline at end of file