20 Private Data

20.1 Introduction

SVG is defined to be a validating XML grammar. This means that elements not defined in the SVG (e.g., elements defined in a different namespace) are only allowed in particular designated sections of the SVG grammar.

The only places in the SVG grammar where arbitrary elements and/or character data are allowed are:

The <private> element is meant for elements and character data which are not defined as a part of the formal SVG grammar. Common uses for <private> are:

For example, a business graphics authoring application might want to include some private data within the <defs> section when it writes a SVG file so that it could properly reassemble the chart (a pie chart in this case) upon reading it back in:

<?xml version="1.0" standalone="yes"?>
<svg width="4in" height="3in"
 xmlns = 'http://www.w3.org/Graphics/SVG/svg-19990412.dtd'>
    <private xmlns:myapp="http://mycompany/mapapp" >
      <myapp:piechart title="Sales by Region">
        <myapp:piece label="Northern Region" value="1.23"/>
        <myapp:piece label="Eastern Region" value="2.53"/>
        <myapp:piece label="Southern Region" value="3.89"/>
        <myapp:piece label="Western Region" value="2.04"/>
        <!-- Other private data goes here -->
    <desc>This chart includes private data in another namespace
  <!-- In here would be the actual graphics elements which
       draw the pie chart -->

Download this example