</>
Skip to content
XML lessons (26/29)

XML — Attributes Reference

Basic Attributes

<element attribute="value"/>

Attribute Types

TypeDescription
CDATACharacter data
IDUnique identifier
IDREFReference to ID
NMTOKENName token
EnumerationList of values

Attribute Defaults

DefaultDescription
#REQUIREDMust be present
#IMPLIEDOptional
#FIXEDAlways this value
"default"Default value

Common Attributes

AttributeElementsDescription
idAnyUnique identifier
classHTMLCSS class
styleHTMLInline CSS
hrefa, linkURL
srcimg, scriptSource URL
typeinput, scriptType
nameform, inputName

Namespace Attributes

<element xmlns:prefix="URI" xml:lang="en"/>

XML Special Attributes

AttributeDescription
xml:langLanguage
xml:spaceWhitespace handling
xmlnsNamespace declaration
xsi:typeSchema type

Mini Practice

  1. Add standard attributes
  2. Use different attribute types
  3. Set attribute defaults
  4. Use namespace attributes

Up Next

Continue with Schema Reference — XSD type reference.

Related Topics

Frequently Asked Questions about Attributes Reference

What is Attributes Reference in XML?

Attributes Reference is a fundamental concept in XML. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Attributes Reference?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Attributes Reference.

Why is Attributes Reference important in XML?

Attributes Reference is essential for XML development. Understanding this concept will help you write better code and solve real-world problems more effectively.