XML·XML from well-formed documents to XSLT

Namespaces

Use xmlns prefixes to combine vocabularies without collisions.

Beginner 12 min read Lesson 3 of 300 Challenge included
What you will be able to do
  • Declare xmlns on the root or the scope where it is used.
  • Use xmlns:prefix for prefixed names.
  • The URI is the identity, not the prefix.
  • Attributes without a prefix are in no namespace.

In plain English

Namespaces qualify element and attribute names. A prefix is only a shorthand for a URI. Different prefixes can point to the same namespace, so compare the URI, not the prefix.

namespaces.xmlHTML
<feed xmlns="http://www.w3.org/2005/Atom"
      xmlns:x="https://example.com/x">
  <title>EduByte</title>
  <x:meta x:version="1" />
</feed>
Your turn

Declare a namespace

Easy

Add a default Atom namespace to a feed element.

HTML · starter
<feed>
Check your understanding before moving on.
Knowledge checkQuestion 1

What identifies a namespace?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: DTD and XSD
Lesson 3 of 300 · 0% of course