[Clipart] Re: SVG support for getID3
Bryce Harrington
bryce at bryceharrington.org
Wed Feb 15 13:13:00 PST 2006
On Wed, Feb 15, 2006 at 11:24:19AM -0800, Jon Phillips wrote:
> On Wed, 2006-02-15 at 11:13 -0500, Jonadab the Unsightly One wrote:
> > "James Heinrich - getID3" <info at getid3.org> writes:
> >
> > > The simple thing is to figure out the magic bytes that identify SVG
> >
> > The "simple thing", eh?
> >
> > I suspect that may prove to be the harder thing, of the two.
> >
> > I was almost sure we previously discussed the question of magic bytes
> > for SVG and concluded that there aren't any as such.
>
> Right, since SVG is plain text. I think we should consider that we might
> need our own php equivalent to SVG::Metadata.
Actually, what we need for this is a bit more basic than what
SVG::Metadata does. With the magic byte approach, we can detect that it
is an XML file. Go ahead and run 'file *.svg' and you'll see that it
can correctly determine that SVG files are XML. What we need next is a
way to report what *kind* of XML it is.
One way would be to retrieve the root element(s) and see if it is
<svg...>. We'll also have to account for namespaces somehow; the file
needs to have something like the following in its root element:
xmlns="http://www.w3.org/2000/svg"
I don't know if we can count on that being there for any arbitrary SVG
file.
I notice there's a bunch of programs in /usr/bin/*xml*; would someone
like to experiment with them and see if any of them are able to report
the XML file type?
Bryce
More information about the clipart
mailing list