XML Attribute
specifies a single property for the element, using a
name/value
pair. An XML-element can have
one or more
attributes
<a href = "http://www.applications.ge/">Applications.ge</a>
In the example
href
is the
attribute name
and
http://www.applications.ge
is the
attribute value
...
XML attribute names (unlike HTML) are case sensitive. Which means that
HREF
and
href
are considered two different XML attributes
<?xml version="1.0"?>
<student>
<a href="http://www.applications.ge/" hreF="HTTP://applications.ge/">Applications.ge</a>
</student>
Several different values for the same attribute is not allowed. An attribute name must not appear more than once in the same tags:
<?xml version="1.0"?>
<student>
<a href="http://www.applications.ge/" href="HTTP://applications.ge/">Applications.ge</a>
</student>
The following error will appear on the browser
error on line 3 at column 73: Attribute href
redefined
Attribute names must always be defined without quotation marks, whereas attribute values must always appear in single or double quotation marks
<?xml version="1.0"?>
<student>
<a "href"="http://www.applications.ge/">Applications.ge</a>
</student>
The following error will appear:
error on line 3 at column 8: error parsing attribute name
Attribute values must always be in quotation marks (single
'
or double
"
quotes)
<?xml version="1.0"?>
<student>
<a href=http://www.applications.ge/>Applications.ge</a>
</student>
This incorrect syntax will generate the following error:
error on line 3 at column 13: AttValue: " or ' expected