[Inkscape-devel] Re: [Clipart] file/magic/mime types for SVG and suggested viewers?

MenTaLguY mental at rydia.net
Sat Jun 5 11:58:14 PDT 2004

On Sat, 2004-06-05 at 02:19, Bryce Harrington wrote:
> On Fri, 4 Jun 2004, Jeremy C. Reed wrote:
> > I can submit it. But I don't know if it is possible to create a magic(5)
> > for SVG since they can start so many different ways.
> Hmm, good point, though isn't XML by definition supposed to contain
> indicators of what *type* of XML it is?

Not really.  Doctypes used to be sort of helpful, but nowadays with XML
namespaces you can have a mixture of namespaces/grammars/schemas.

Think about e.g. SVG-in-XHTML for example.  Or XHTML-in-SVG.  Or worse,

Needless to say this is also giving the MIME folks fits. :P

> > Does anyone know how to configure magic so the offset is not forced? (For
> > example "<!DOCTYPE svg" could be at 141 position or could be at some other
> > position. Or the "<svg" marker may be at some random place.
> I'm also CCing to the Inkscape mailing list in case someone there can
> answer it.

Just looking for <!DOCTYPE svg isn't really robust -- you'd need match
on the appropriate public identifier ("-//W3C//etc...").  That's
assuming there is a DOCTYPE declaration.

[ Except when we're writing "pure" SVG, we really shouldn't add a
DOCTYPE declaration unless we're prepared to include a complete external
DTD subset thingy that covers all the additional elements/attributes in
the document (whether introduced by Inkscape or not, which introduces
the problem of needing to do Examplotron-style schema inference). ]

Looking for namespace decls is even trickier; you can't assume that the
SVG namespace is the default namespace, or that its prefix will be 'svg'
(it's not required to be).

Strictly speaking, even the initial <?xml version="1.0"?> declaration is
optional (at least in the 1.0 spec -- this is widely viewed as having
been a bad idea, in retrospect) 

The short answer is that it is far, far outside the capabilities of
magic(1) to detect a specific XML application, and there's even a great
deal of question about what the appropriate MIME types would be in
nontrivial cases.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/clipart/attachments/20040605/c664be12/attachment.pgp>

More information about the clipart mailing list