Skip to Content
SVG Essentials
book

SVG Essentials

by J. David Eisenberg
February 2002
Intermediate to advanced
356 pages
7h 56m
English
O'Reilly Media, Inc.
Content preview from SVG Essentials

Appendix F. Using SVG with Other XML Applications

John Donne said that no man is an island, and likewise SVG is not the only XML application in the universe. In fact, as an XML application, SVG is intended to be used with other XML applications. We’ll explore several such uses in this appendix.

Referring to an SVG Document in HTML

OK, so we lied. HTML isn’t an XML application, but you’ll still want to put SVG graphics in a web page. For most browsers, this is done by using a plug-in. As of this writing, Adobe’s SVG viewer plugin is available for Windows and Macintosh systems. To have a plug-in display in an SVG file within an HTML document, you use the <embed> element. The src attribute specifies the file in which the SVG resides, and the width and height attributes tell how much screen space to reserve for the graphic. The graphic will be centered in the space that you specify. You must also specify a type attribute with a value of image/svg+xml.

<embed src="some_file.svg" width="100" height="200"
    type="image/svg+xml" />

Additionally, you may specify a pluginspage attribute whose value is a URL where users may download the plug-in.

Referring to an SVG Document in XHTML

This is where things get interesting. First, the <embed> element is deprecated in HTML 4.0, and nonexistent in HTML 4.01 and XHTML. Obviously, this calls for other measures. In place of <embed>, you must use the <object> element. It also needs a height, width, and type, but it uses the data attribute to specify where ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

SVG Essentials, 2nd Edition

SVG Essentials, 2nd Edition

J. David Eisenberg, Amelia Bellamy-Royds
SVG Unleashed

SVG Unleashed

Chris Lilley, Andrew H. Watt
Mastering SVG

Mastering SVG

Rob Larsen
Modern SVG

Modern SVG

Amelia Bellamy-Royds, Kurt Cagle

Publisher Resources

ISBN: 0596002238Errata Page