Quackit Logo
FREE Hosting!
With every domain you register with ZappyHost you get FREE hosting.
Create free Flash websites

XML Attributes

Print Version

The previous lesson covered the syntax rules related to XML elements. XML elements can also contain attributes. You use attributes within your elements to provide more information about the element. These are represented as name/value pairs.

Example:

<tag attribute="value">Data</tag>

It's important to remember the following syntax rules when using attributes.

Quotes

You must place quotation marks around the attribute's value.

Wrong:

<tutorials type=Web>
  <tutorial>
    <name>XML</name>
  </tutorial>
</tutorials>

Right:

<tutorials type="Web">
  <tutorial>
    <name>XML</name>
  </tutorial>
</tutorials>

Shorthand Is Prohibited

Attributes must contain a value. Some HTML coders like to use shorthand, where if you provide the attribute name without a value, it will equal true. This is not allowed in XML.

Wrong:

<tutorials published>
  <tutorial>
    <name>XML</name>
  </tutorial>
</tutorials>

Right:

<tutorials published="true">
  <tutorial>
    <name>XML</name>
  </tutorial>
</tutorials>

Enjoy this website?

  1. Add this page to your Favorites
  2. Link to this page (copy/paste into your own website or blog):
  3. Help support Quackit by making a donation

Oh, and thank you for supporting Quackit!

Need Website Content?
Get unique, quality digital content for your website.
  • 270+ Website Templates
  • 800+ Flash Templates
  • 25,000+ Images, Logos
  • 30,000+ e-Books
  • 15,000+ Scripts
  • 27,000+ Animated GIFs
  • 21,000+ Ringtones
  • ...and much more!
Get your content now!
$1.99 .info domain names!
© Copyright 2000 - 2010 Quackit.com