Basic Data Types

This chapter defines a number of common data types used in the definitions of SVG properties and attributes. Some data types that are not referenced by multiple properties and attributes are defined inline in subsequent chapters.

<boolean>

A boolean value, specified as either 'true' or 'false'.

<Char>

A character, as defined by the Char production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.2), or the Char production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.2) if the document is an XML 1.1 document.

<Clock-value>

An amount of time, used by various attributes on timed elements. The grammar describing possible values for a <Clock-value> is given in the Clock values section of the Animation chapter.

<color>

The basic type <color> defines a color within the sRGB color space [SRGB]. The <color> type is used as the value of the 'color' property and is a component of the definitions of properties 'fill', 'stroke', 'stop-color', 'solid-color' and 'viewport-fill'.

All of the syntax alternatives for <color> defined in Syntax for color values must be supported. All RGB colors are specified in the sRGB color space [SRGB]. Using sRGB provides an unambiguous and objectively measurable definition of the color, which can be related to international standards [COLORIMETRY].

<content-type>

An Internet media type, as per Multipart Internet Mail Extensions: (MIME) Part Two: Media Types [RFC2046].

<coordinate>

A <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length>.

<focus>

The type of value that can be used in the various navigation attributes, such as 'nav-next', 'nav-prev', etc. See Specifying navigation for the definition of the values that can be used in those attributes.

<font-family-value>

A list of font family names and generic names. Specifically, this is the type of value that can be used for the 'font-family' property, excluding the 'inherit' value.

<family-name>

A single font family name as given by a <family-name>, as defined in Extensible Stylesheet Language (XSL) Version 1.1 ([XSL], section 7.9.2).

<font-size-value>

A value that can be used for the 'font-size' property, excluding the 'inherit' value.

<FuncIRI>

Functional notation for an IRI: "url(" <IRI> ")".

<ID>

The type of value that can be used in an XML attribute of type ID (such as 'id' and 'xml:id'); that is, a string matching the Name production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3), or the Name production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.3) if the document is an XML 1.1 document.

<IDREF>

The type of value that can be used in an XML attribute of type IDREF (such as 'observer'); that is, a string matching the Name production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3), or the Name production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.3) if the document is an XML 1.1 document.

<integer>

An <integer> is specified as an optional sign character ("+" or "-") followed by one or more digits "0" to "9". If the sign character is not present, the number is non-negative.

<integer> values in conforming SVG Tiny 1.2 content must be within the range of -32,768 to 32,767, inclusive.

<IRI>

An Internationalized Resource Identifier (see IRI). For the specification of IRI references in SVG, see IRI references.

<language-id>

The type of value accepted by the 'xml:lang' attribute as defined in Extensible Markup Language (XML) 1.0 ([XML10], section 2.12) and Extensible Markup Language (XML) 1.1 ([XML11], section 2.12). Specifically, this is either a language tag as defined by BCP 47 ([BCP 47], section 2) or the empty string.

<length>

A length is a distance measurement. The format of a <length> is a <number> optionally followed by a unit identifier. If the <length> is expressed as a value without a unit identifier (e.g., '48'), then the <length> represents a distance in the current user coordinate system.

SVG Tiny 1.2 only supports optional units on the 'width' and 'height' attributes on the 'svg' element. These can specify values in any of the following units: in, cm, mm, pt, pc, px and %. If one of the unit identifiers is provided (e.g., '12mm'), then the <length> is processed according to the description in Units.

Percentage values (e.g., '10%') on the 'width' and 'height' attributes of the 'svg' element represent a percentage of the viewport size (refer to the section that discusses Units in general).

<list-of-content-types>

A space-separated list of Internet media types, as used by the 'requiredFormats' attribute.

The following is an EBNF grammar describing the <list-of-content-types> syntax [EBNF]:

list-of-content-types ::= content-type
                          | content-type wsp list-of-content-types
wsp                   ::= (#x9 | #xD | #xA | #x20)*
<list-of-family-names>

A <list-of-family-names> is a list of font family names using the same syntax as the 'font-family' property, excluding the <generic-family> and 'inherit' values.

<list-of-language-ids>

A <list-of-language-ids> is a comma separated list of non-empty <language-id> values. White space may be used before or after the commas.

<list-of-strings>

A <list-of-strings> consists of a separated sequence of <string>s. String lists are white space-separated, where white space is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A) and "carriage return" (U+000D).

The following is an EBNF grammar describing the <list-of-strings> syntax [EBNF]:

list-of-strings ::= string
                    | string wsp list-of-strings
wsp             ::= (#x9 | #xD | #xA | #x20)*
<list-of-Ts>

(Where T is a type other than <content-type>, <string>, <language-id> and <family-name>.) A list consists of a separated sequence of values. Unless explicitly described differently, each pair of list items can be separated either by a comma (with optional whitespace before and after the comma) or by white space alone.

White space in lists is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A) and "carriage return" (U+000D).

The following is a template for an EBNF grammar describing the <list-of-Ts> syntax [EBNF]:

list-of-Ts ::= T
               | T comma-wsp list-of-Ts
comma-wsp ::= (wsp+ comma? wsp*) | (comma wsp*)
comma     ::= ","
wsp       ::= (#x9 | #xD | #xA | #x20)

Substituting a type other than <content-type>, <string>, <language-id> and <family-name> for T will yield a grammar for a list of that type.

<long>

A <long> is specified as an optional sign character ("+" or "-") followed by one or more digits "0" to "9". If the sign character is not present, the number is non-negative.

<long> values in conforming SVG Tiny 1.2 content must be within the range of -2,147,483,648 to 2,147,483,647, inclusive.

<NCName>

An XML name without colons, as defined by the NCName production in Namespaces in XML 1.0 ([XML-NS10], section 3), or the NCName production in Namespaces in XML 1.1 ([XML-NS], section 3) if the document is an XML 1.1 document.

<number>

A <number> value is specified in either decimal or scientific notation. A <number> using decimal notation consists of either an <integer>, or an optional sign character followed by zero or more digits followed by a dot (.) followed by one or more digits. Using scientific notation, it consists of a number in decimal notation followed by the letter "E" or "e", followed by an <integer>.

The following is an EBNF grammar describing the <number> syntax [EBNF]:

number            ::= decimal-number | scientific-number
decimal-number    ::= integer
                      | ("+" | "-")? [0-9]* "."  [0-9]+
scientific-number ::= decimal-number [Ee] integer

<number> values in conforming SVG Tiny 1.2 content must have no more than 4 decimal digits in the fractional part of their decimal expansion and must be in the range -32,767.9999 to +32,767.9999, inclusive. It is recommended that higher precision floating point storage and computation be performed on operations such as coordinate system transformations to provide the best possible precision and to prevent round-off errors.

<paint>

The values for properties 'fill' and 'stroke' are specifications of the type of paint to use when filling or stroking a given graphics element. The available options and syntax for <paint> are described in Specifying paint.

<path-data>

The <path-data> type is used to represent path data, as can be specified in the 'd' attribute on a 'path' element. See the detailed description of path data, including the grammar for path data.

<points-data>

The <points-data> type is used to represent a list of points, as can be specified in the 'points' attribute on a 'polyline' or 'polygon' element. See the grammar for points data.

<QName>

The <QName> type is a qualified name, as defined by the QName production in Namespaces in XML 1.0 ([XML-NS10], section 3), or the QName production in Namespaces in XML 1.1 ([XML-NS], section 3) if the document is an XML 1.1 document. If the <QName> has a prefix, then the prefix is expanded into a tuple of an IRI reference and a local name, using the namespace declarations in effect where the name occurs. Note that, as with unprefixed attributes, the default namespace is not used for unprefixed names.

<string>

A sequence of zero or more <Char>s.

<transform>

A <transform> is a transformation specification, as can be specified in the 'transform' attribute. As described in The 'transform' attribute, three types of values are allowed: a transform list, a transform reference and the 'none' value.

The following is an EBNF grammar describing the <transform> syntax [EBNF]:

transform ::= transform-list | transform-ref | "none"
<XML-Name>

An XML name, as defined by the Name production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3), or the Name production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.3) if the document is an XML 1.1 document.

<XML-NMTOKEN>

An XML name token, as defined by the Nmtoken production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3), or the Nmtoken production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.3) if the document is an XML 1.1 document.

<XML-NMTOKENS>

An space separated sequence of XML name tokens, as defined by the Nmtokens production in Extensible Markup Language (XML) 1.0 ([XML10], section 2.3), or the Nmtokens production in Extensible Markup Language (XML) 1.1 ([XML11], section 2.3) if the document is an XML 1.1 document.