Skip to content

Element in default namespace displayed wrong if attribute has a namespace

Created by: IMSoP

While constructing tests for #3, I found a different oddity: currently, I'm relying on ->getNamespaces(false) returning the namespace of the current element, but that's not actually what it does. Instead, it lists all namespaces used by the current element, including its attributes.

Consider the following:

<?xml version="1.0" standalone="yes"?>
<notinnamespace xmlns:test="http://example.com" test:isinnamespace="true" />

Here, the prefix test is used in the element (by the attribute) but isn't the namespace to which the element belongs. Since there is no default namespace defined, there's no '' key in the getNamespaces output, so the output is [ 'test' => 'http://example.com' ], leading to broken dump output.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information