ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 1 / 10 << | Prev | Next | |
In XML Schema, the datatype is referenced by the QName. The namespace must be mapped to the prefix.
Valid document <root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >25</root> |
Correct XML Schema (correct_0.xsd) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="xsd:integer"/> </xsd:schema> |
In XML Schema, the datatype is referenced by the QName. If the XML Schema is the default namespace, then you can reference the datatypes without a prefix.
Valid document <root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >25</root> |
Correct XML Schema (correct_0.xsd) |
Relax NG can use the XML Schema datatypes. They can be imported using the "datatypeLibrary" attribute.
Valid document <root xmlns="">10</root> Invalid document <root xmlns="">1.5</root> |
Correct Relax NG schema (correctRelax_0.rng) <grammar datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://relaxng.org/ns/structure/1.0" > <start> <element> <name ns="">root</name> <data type="integer"/> </element> </start> </grammar> Correct Relax NG schema (correctRelax_1.rng) |