• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL



Congratulations! You have just chosen a book that will provide you with information to unleash the power of Scalable Vector Graphics (SVG).

SVG is an immensely powerful graphics tool for use on the Web and elsewhere. In parallel with its immense power and potential, it is also based on a relatively complex specification. Reading SVG Unleashed will provide you with the perspective to understand how to use most of the SVG specification and also provide you with lots of working SVG code that you can use to get up to speed in this exciting new vector graphics world.

SVG Unleashed covers the SVG elements themselves, showing you essential syntax and techniques. In addition, you will see how to use SVG with JavaScript, Java, XSLT, and other languages. The XML and SVG Document Object Models are also described, with examples showing how you can manipulate the Document Object Model, the DOM, of an SVG document.

Creating SVG on the server is an important technique to master for dynamic creation of SVG, and in several chapters, you are introduced to techniques that enable you to create SVG on the server to meet diverse needs.

Who This Book's Intended Audience Is

This book is written for those with at least some experience with Web development using at least a scripting language, such as JavaScript, or who have significant programming experience with a full programming language such as Java, C++, or Perl. We also assume that you have at least some basic understanding of XML.

The main focus of this book is SVG, and we don't assume that you already know much SVG. However, we do assume that you have experience using the Web and that you are a quick learner, so that the maximum information about SVG can be contained in the available space.

Any knowledge you have of one of the programming languages in this book will help you get the most from the relevant chapters. We have, however, worked hard to try to help you gain an understanding of the techniques to be used with SVG, even if you aren't already familiar with each of the scripting and programming languages we use.

We assume that you want to use SVG in the real world and will want to get your hands dirty using SVG code. If you choose, you can do that by typing in code. Likely, you will want to make use of the code downloads available from the Sams Publishing Web site (http://www.samspublishing.com). Running the code and viewing the result in an SVG viewer are essential if you want fully to appreciate the animations and interactivity that are incorporated in many of the examples created in the book.

What You Will Learn from Reading This Book

This book covers a broad range of topics that give you the necessary knowledge to create static and animated SVG documents. Each of the SVG version 1.0 elements is described, with many examples showing how to use various attributes for an element. The interfaces of the XML DOM and version 1.0 of the SVG DOM are introduced and many examples shown.

Later chapters in the book cover the use of JavaScript with SVG and also show you how several programming languages can be used server-side to generate SVG. The case studies will help you appreciate where SVG creation fits into real-life development scenarios.

What Software You Will Need to Complete the Examples Provided with This Book

To create SVG by hand, you can use any simple text editor. Having an XML-aware text editor with code highlighting will ease the task of identifying syntax errors. An editor that can validate against the SVG 1.0 Document Type Definition (DTD) will provide another level of assistance.

To view SVG, you will need an SVG rendering engine, also known as an SVG viewer. Installation of these tools is described in Chapter 1, “SVG Overview.”

To use the programming languages employed to script or generate SVG, you will need appropriate language tools. In many cases, free open-source tools are available.

How This Book Is Organized

This book is divided into the following parts.

Part I: SVG Fundamentals

The book begins with a personal insight into the creation of SVG from Chris Lilley, Chairman of the W3C's SVG Working Group.

Most of Part I of the book builds a foundation for your use of SVG by describing the SVG 1.0 elements and providing examples that show how to use them. The XML DOM and SVG DOM are also introduced, and examples of using the DOM with JavaScript are shown. Many SVG animations and transformations are demonstrated. The final chapter in this part describes how SVG can be used to aid accessibility.

Part II: Programming SVG Client-Side

SVG animations can be created using declarative syntax alone. However, adding scripting using a language such as JavaScript appends powerful options for control of interactivity with the user of the SVG that you create. Part II is intended to ensure that you understand how to use JavaScript with SVG.

Part III: Producing SVG Server-Side

In many scenarios, you will likely want to create SVG dynamically on a Web server. In this part of the book, you will be introduced to general issues of creating SVG on a Web server, including configuration of the server to allow SVG to be served.

In addition, we will discuss and demonstrate the creation of SVG using Java, with servlets or JavaServer Pages (JSP), the Extensible Stylesheet Language Transformations (XSLT), and Perl.

Part IV: Case Studies

This part of the book consists of several case studies that demonstrate how SVG can be used in the production of architectural and construction diagrams and creation of SVG maps.

Part V: Looking Ahead

The final part of the book is a look ahead to the future of SVG written by Chris Lilley. Chris is in a unique position to point to future developments in SVG, as it moves through the upcoming versions 1.1, 1.2, and 2.0. This part will provide you with a vista into SVG's future, showing you some of the exciting things you will be able to do to build further on the skills you have learned in SVG Unleashed using SVG 1.0.

What's on the Sams Web Site for This Book

The code files for this book, chapter by chapter, are available at http://www.samspublishing.com/. Enter the ISBN for this book without the hyphens in the Search box and click the Search button. When the book's title is displayed, click the title to go to a page where you can download all the code.

Conventions Used in This Book

This book uses certain conventions to help make the book more readable and helpful:

  • Code listings, methods, elements, functions, and other code terms appear in a monospace font.

  • Placeholders (words with substitutes for what you actually type) appear in a monospace italic font.

  • Sometimes a code line that should appear on one line is unable to fit on a single line in this book. When this happens, the line is broken and continued on the next line, preceded by a character.

In addition, this book uses special sidebars that are set apart from the rest of the text, including Notes, Tips, and Cautions.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint