W3C home > Mailing lists > Public > www-svg@w3.org > October 2005

Re: entities in SVG (middle term view)

From: Chris Lilley <chris@w3.org>
Date: Mon, 10 Oct 2005 18:31:21 +0200
Message-ID: <1469606144.20051010183121@w3.org>
To: "Andre M. Winter - Vectoreal.com" <andre.winter@vectoreal.com>
Cc: www-svg@w3.org

On Sunday, October 9, 2005, 5:18:34 PM, Andre wrote:

AMWVc> hi,

AMWVc> i am writing ab SVG-book for mapping people describing useful features 
AMWVc> to be used with SVG. one of those are entities. just like CSS there are 
AMWVc> pros and cons on that topic, but when working e.g. with animations they 
AMWVc> help a lot.
AMWVc> entities need to be defined in the DOCTYPE-tag,

(the DOCTYPE declaration is not a tag. Normally i would let that one
slide, but you mentioned writing a book so....)

AMWVc>  but this one seems to
AMWVc> get deprecated. so my question is: will there by an entity-like 
AMWVc> mechanism in SVG1.2+ or will they remain and in this case how may they 
AMWVc> be defined.

You should distinguish the internal DTD subset (ie, the part in the svg
file) from the external DTD subset (ie the external file or files that
people think of as "the DTD". All XML parsers are required to parse the
internal DTD subset. Fetching and pasing the external DTD subset is
optional for parsers that do not do DTD validation, which is itself
optional.

You should also distinguish between parsing and validation.

Having got that clear:
- SVG 1.2 does not use a DTD for validation
- SVG 1.2 files can use an internal DTD subset to declare entities if
they wish, just as before.

For example (this entity draws a smiley face)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg [
    <!ENTITY Smile "
    <rect x='.5' y='.5' width='29' height='39' fill='black' stroke='red'/>
    <g transform='translate(0, 5)'>
    <circle cx='15' cy='15' r='10' fill='yellow'/>
    <circle cx='12' cy='12' r='1.5' fill='black'/>
    <circle cx='17' cy='12' r='1.5' fill='black'/>
    <path d='M 10 19 L 15 23 20 19' stroke='black' stroke-width='2'/>
    </g>
    ">
    ]>
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="Tiny">
   <desc>This example shows the use of an entity defined in the 
      internal DTD subset. Note that there is no external DTD subset 
      for SVG 1.2, and thus no formal public identifier.</desc>
   &Smile; 
</svg>



-- 
 Chris Lilley                    mailto:chris@w3.org
 Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG
Received on Monday, 10 October 2005 16:31:30 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:31 GMT