Attributes

Attributes are name-value pairs that may appear in a start- or empty-element tag.

Productions

[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
1.0
[2] Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] 1.1
[3] S ::= (#x20 | #x9 | #xD | #xA)+
[4] NameChar::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
1.0
[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
[#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] |
[#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] |
[#x10000-#xEFFFF] 1.1
[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] |
[#x203F-#x2040] 1.1
[5] Name::= (Letter | '_' | ':') (NameChar)* 1.0
[5] Name ::= NameStartChar (NameChar)* 1.1
[10] AttValue     ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
[25] Eq ::= S? '=' S?
[39] element ::= EmptyElemTag | STag content Etag
[40] Stag ::= '<' Name (S Attribute)* S? '>'
[41] Attribute ::= Name Eq AttValue
[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'
[67] Reference ::= EntityRef | CharRef
[68] EntityRef ::= '&' Name ';'
[69] PEReference ::= '%' Name ';'

Examples

<message xmlns="http://simonstl.com/ns/examples/message"
   xml:lang="en" date="20051006" >
   This is a message!
</message>

<photo source="photos/mypic.jpg" description="photo of moi"/>

Description

In effect, attributes modify an element in some way. They appear as a list after the ...

Get XML Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.