Quackit Logo
HTML
CSS
Scripting
Database
Hosting
Design
XML
IMCreator - Free Website Builder

XML Local Namespace

In the previous lesson, we created a namespace to avoid a name conflict between the elements of two documents we wanted to combine. When we defined the namespace, we defined it against the root element. This meant that the namespace was to be used for the whole document, and we prefixed all child elements with the same namespace.

You can also define namespaces against a child node. This way, you could use multiple namespaces within the same document if required.

Example Local Namespace

Here, we apply the namespace against the title element only:

Code

Multiple Namespaces

You could also have multiple namespaces within your XML document. For example, you could define one namespace against the root element, and another against a child element.

Example:

Code

Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!