ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index | >> Example 1 / 3 << | Prev | Next |
Contents > Associating schema with document > Document root element is from null namespace

Document root element is from null namespace

  1. XML Schema
  2. Relax NG

1. XML Schema

Let's start with our first document. It must have only "root" element and this element can contain text only. The element is from null namespace.

Valid document


<root xmlns="">aaa</root>

Valid document
If you want to validate this document with XML Schema, you have to associate some Schema document with it. If the root element is from null namespace, you will use "noNamespaceSchemaLocation" attribute.


<root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > test </root>

2. Relax NG

Relax NG does not interfere to the structure of the validated document.