ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 7 / 8 << | Prev | Next | |
Please, send all comments, bug-reports, and contributions to Jiri.Jirat@systinet.com. Thank you very much.
Relax NG keys: externalRefWhen using the "externalRef" element, the root element of the included file must match the syntax of a pattern. In this example there is no "ns" attribute in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one). See externalRef element.
Valid document <foo:root xmlns:foo="http://foo" > <foo:x>dhhglh</foo:x> </foo:root> Invalid document <foo:root xmlns:foo="http://foo" > <x xmlns="">dhhglh</x> </foo:root> |
Correct Relax NG schema (correctRelax_0.rng) <grammar ns="http://foo" xmlns="http://relaxng.org/ns/structure/1.0" > <start> <element name="root"> <externalRef href="correctRelax_1.rng"/> </element> </start> </grammar> Correct Relax NG schema (correctRelax_1.rng) |
In this example the "ns" attribute is set to null-namespace in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one).
Valid document <foo:root xmlns:foo="http://foo" > <x xmlns="">dhhglh</x> </foo:root> Invalid document <foo:root xmlns:foo="http://foo" > <foo:x>dhhglh</foo:x> </foo:root> |
Correct Relax NG schema (correctRelax_0.rng) <grammar ns="http://foo" xmlns="http://relaxng.org/ns/structure/1.0" > <start> <element name="root"> <externalRef href="correctRelax_1.rng"/> </element> </start> </grammar> Correct Relax NG schema (correctRelax_1.rng) |