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:

<g>
  <defs>
    <private xmlns:myapp="http://mycompany/mapapp" >
      <myapp:piechart title="Sales by Region">
        <piece label="Northern Region" value="1.23"/>
        <piece label="Eastern Region" value="2.53"/>
        <piece label="Southern Region" value="3.89"/>
        <piece label="Western Region" value="2.04"/>
        <!-- Other private data goes here -->
      </myapp:piechart>
    </private>
  </defs>
  <!-- In here would be the actual graphics elements which
       draw the pie chart -->
</g>