>> English << | česky | Español | Português | Türkçe | Nederlands | По-русски | Deutsch | Français | Italiano | 中文 | ქართული | Magyar | PolskiZVON > Tutorials > XML Tutorial
>> Example 7 << | Prev | Next | Contents

Description

An element can have none, one or several attributes. Permitted characters are the same as for element names. The name of attribute is separated from its value by =. The attribute value must be given inside apostrophes '...' or double-quotes "..." . If an apostrophe or double-quote is used in the attribute value the opposite delimiter must be used.

Well-formed documents


Document with well formed attributes:


<elements-with-attributes>

     <el _ok = "yes" />

     <one attr = "a value"/>

     <several first="1" second = '2' third= "333"/>

     <apos_quote case1="John's" case2='He said: "Hello, world!"  '/>

</elements-with-attributes>


Documents with errorsTop


Document with erroneous attributes:


<errors>

     <wrong_char a*b = "23432"/>

     <mismatched_separator value = "12'/>

     <wrong_separator_type  value="aa"aa"/>

     <wrong_separator_type  value='bb'bb'/>

     <wrong_start XML-ID = "xml234"/>

</errors>