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:
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'> <defs> <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 --> </myapp:piechart> </private> </defs> <desc>This chart includes private data in another namespace </desc> <!-- In here would be the actual graphics elements which draw the pie chart --> </svg>
Download this example