ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 9 / 9 << | Prev | Next | |
This should be a simple task - we want the element "root" to contain text only and have just one attribute, named "xx".
Valid document <f:root xsi:schemaLocation="http://foo correct_0.xsd" xx="1" xmlns:f="http://foo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > qwerty uiop </f: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"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:string"> <xsd:attribute name="xx" type="xsd:string" use="required"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element> </xsd:schema> |
Valid document <f:root xx="1" xmlns:f="http://foo" > qwerty uiop </f:root> |
Correct Relax NG schema (correctRelax_0.rng) |