Title Text Goes Here


XML Elements vs. Attributes



Download 2.8 Mb.
View original pdf
Page37/37
Date16.06.2022
Size2.8 Mb.
#59010
1   ...   29   30   31   32   33   34   35   36   37
com-225-web-technology-theory
XML Elements vs. Attributes
Take a look at these examples
Anna
Smith
female
Anna
Smith In the first example sex is an attribute. In the last, sex is an element. Both examples provide the same information. There are no rules about when to use attributes and when to use elements. Attributes are handy in HTML. In XML my advice is to avoid them. Use elements instead.
My Favorite Way
The following three XML documents contain exactly the same information A date attribute is used in the first example

Tove
Jani
Reminder
Don't forget me this weekend Don't forget me this weekend Don't forget me this weekend Don't forget me this weekend I will not Don't forget me this weekend Don't forget me this weekend Don't forget me this weekend

Download 2.8 Mb.

Share with your friends:
1   ...   29   30   31   32   33   34   35   36   37




The database is protected by copyright ©ininet.org 2022
send message

    Main page