ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 2 / 4 << | Prev | Next | |
We will create our own simpleType, based on integer. The element "root" must be of that type.
Valid document <root xsi:schemaLocation="http://foo correct_0.xsd" xmlns="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >24</root> Invalid document <root xsi:schemaLocation="http://foo correct_0.xsd" xmlns="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >abc</root> |
Correct XML Schema (correct_0.xsd) <xsd:schema targetNamespace="http://foo" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://foo" > <xsd:element name="root" type="foo:myInteger"/> <xsd:simpleType name="myInteger"> <xsd:restriction base="xsd:integer"/> </xsd:simpleType> </xsd:schema> |
The naming of RelaxNG patterns is by no means bound to namespace.
Valid document <root xmlns="http://foo" >24</root> Invalid document <root xmlns="http://foo" >abc</root> |
Correct Relax NG schema (correctRelax_0.rng) |