ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 1 / 3 << | Prev | Next | |
If we use the attribute "noNamespaceSchemaLocation", we say that the schema is for element from null namespace.
Valid document <root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > test </root> |
Correct XML Schema (correct_0.xsd) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="xsd:string"/> </xsd:schema> |
See, how easily this can be accomplished using Relax NG. The pattern <name ns="">root</name> says, that the root element must be named "root" and that it must be from null namespace.
Valid document <root xmlns=""> test </root> |
Correct Relax NG schema (correctRelax_0.rng) <grammar xmlns="http://relaxng.org/ns/structure/1.0" > <start> <element> <name ns="">root</name> <text/> </element> </start> </grammar> Correct Relax NG schema (correctRelax_1.rng) |