![]() |
|
| • All Online Courses • New Courses • QuickTips • Word Definitions • Submit a Tutorial • Links • |
|
Learn XML programming in this free XML training course What are XML attributes?Attributes are additional pieces of data that are included in the opening tag of an element. When declaring attributes, they are listed right before the closing bracket of the opening tag, and aren’t listed anywhere else in the element. The style of the attribute is attribute_name=”attribute_data”. Attributes can consist of any of a variety of types of data… pictures, serial numbers, product names, and more can be recorded as an attribute and used in multiple ways in XML. As an example, let’s say that you’ve created attributes for all four of the cats that you’ve mentioned so far. Since there are only two cats in each element, you can re-use the attributes; you’ve named the attributes cat_1 and cat_2, and they each call up additional data about the cat in question. Putting them into your file, you’d have something that looked like this: <?xml version=”1.0”?> <!- - This XML document is practice, and documents great cats. - -> <?xml-stylesheet type=”text/css” href=”cats.css”?> <cats_info> <cats cat_1=”Tooter” cat_2=”Shade”>Tooter and Shade are the best cats in the world!</cats> <friends cat_1=”Loki” cat_2=”Sally”>Loki and Sally are pretty cool cats as well, though.</friends> </cats_info> Of course, you still have to define what the attributes are used for elsewhere… remember, this is just practice to give you an idea of what an XML document looks like. In the next section and those that follow it, you’ll be introduced to creating stylesheets and other essential parts of XML pages and will leave this basic framework behind. Go ahead and save cats.xml, and get ready to move into the next stage of XML coding.
by John Casteele Find more free Internet tutorials from Learnthat.com. More Information:
Help us by rating this tutorial: [---] [--] [+] [++] [+++] [---] lowest; [+++] highest
|
|
||||||
![]() |
Learn: Free
Tutorials - Links
to Free Tutorials
Understand: Free Technical Definitions
- ExplainThat Whitepapers
Use: Certification Section -
Discussion Forum
Visit Our Network Sites:
About Us : Contact Us : Advertise : Privacy Information