1

I've seen SVGs generated containing an xmlns:serif namespace, for example:

<svg width="180" height="50" version="1.1" xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/"...

I'm seeing this attribute flagged as an unregistered/unknown namespace, when the others in the same SVG are not. Serif's site says nothing about it, and searching hasn't found anything relevant either.

What SVG features are in this namespace, is it necessary, and why would it be considered invalid (for example by the W3C HTML5 validator)?

Synchro
  • 35,538
  • 15
  • 81
  • 104

1 Answers1

1

It's markup litter, presumably from the folks who control the http://www.serif.com/ domain that appears in the namespace URI.

SVG user agents must propagate and ignore unknown XML components from foreign namespaces:

5.11. Foreign namespaces and private data

SVG allows inclusion of elements from foreign namespaces anywhere within the SVG content. In general, the SVG user agent must include the unknown foreign-namespaced elements in the DOM but will ignore and exclude them for rendering purposes.

[...]

Additionally, SVG allows inclusion of attributes from foreign namespaces on any SVG element. The SVG user agent must include unknown attributes in the DOM but should otherwise ignore unknown attributes.

W3C Validation

Though SVG viewers should just ignore those 'foreign' namespace content bits, the validator does not.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • OK, thanks. It seems to be fine if I delete it, but I'm curious as to why it was there to start with, given that it's never been near any Serif software... I also wonder why the W3C validator (of all things) flags it as an error if the spec says it should be ignored if it's unknown. – Synchro Jan 18 '22 at 21:52
  • 1
    Perhaps it's been near other software that uses a Serif library. Anyway, answer updated to address W3C SVG validation of foreign XML namespace components. – kjhughes Jan 18 '22 at 22:39
  • 1
    If you delete that namespace attribute, then you may also need to check for, and delete, any attributes in the file that start with `serif:`. Some parsers and tools will complain or throw an error if it sees an attribute with an undefined namespace. – Paul LeBeau Jan 19 '22 at 09:38
  • @PaulLeBeau: Good point. Using an undefined namespace would cause the SVG to be not [*namespace-well-formed*](https://stackoverflow.com/a/25830482/290085) at the XML level and is indeed better avoided. – kjhughes Jan 19 '22 at 14:56