The nearest declaration of a prefix wins over one further out, and a declaration on the element itself is never overridden.
(t *testing.T)
| 90 | // The nearest declaration of a prefix wins over one further out, and a |
| 91 | // declaration on the element itself is never overridden. |
| 92 | func TestElementToBytesNearestDeclarationWins(t *testing.T) { |
| 93 | const doc = `<a xmlns:p="urn:outer" xmlns="urn:outer-default">` + |
| 94 | `<b xmlns:p="urn:inner" xmlns="urn:inner-default"><c xmlns="urn:own"><p:d/></c></b></a>` |
| 95 | el := mustFindElement(t, doc, "//c") |
| 96 | assertStandalone(t, el) |
| 97 | |
| 98 | buf, err := elementToBytes(el) |
| 99 | assert.Assert(t, err) |
| 100 | out := etree.NewDocument() |
| 101 | assert.Assert(t, out.ReadFromBytes(buf)) |
| 102 | assert.Check(t, is.Equal("urn:own", out.Root().NamespaceURI())) |
| 103 | assert.Check(t, is.Equal("urn:inner", out.FindElement("//d").NamespaceURI())) |
| 104 | } |
| 105 | |
| 106 | // Azure AD sends the Assertion and its Signature unprefixed, each declaring |
| 107 | // its own default namespace. The serialized assertion must keep both |
nothing calls this directly
no test coverage detected