O'Reilly logo

Special Edition Using XML, Second Edition by - et al. David Gulbransen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SVG Document Structure

An SVG document is also an XML document: Therefore, an SVG document begins with an optional XML declaration. It also, optionally, begins with a DOCTYPE declaration.

The <svg> Element

All SVG documents have, as the root element, an <svg> element. The width and height attributes of the <svg> element define the size of the SVG image. The SVG element also has other attributes such as x and y, which are used to position an SVG graphics element. However, on an <svg> element that is the root element, any x or y attribute has no effect.

A skeleton SVG document is shown in Listing 23.8. The DOCTYPE shown is that for the SVG 1.0 Recommendation of September 2001.

Listing 23.8. A Skeleton SVG Document (SkeletonSVG.svg)
 <?xml version="1.0" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required