ZVON
>
References
>
Zvon Example Repository
Intro
/
Search
/
ZVON
Example repository:
index
|
categories
|
search
All
>
Relax NG
>
Simplification - div element
> Test 132
Previous sample
|
Next sample
Author:
James Clark
Origin:
Testsuite
for
Relax NG
Elements
Attributes
define
name
|
div
ns
|
element
name
|
empty
grammar
ref
name
|
start
ZVON comment:
If the
name
element does not have any
ns
attribute, then the attribute is inherited from its ancestor which has
ns
attribute (if any, otherwise it is empty string). The element "foo" must be from the namespace "http://www.example.com".
Correct schema
<
grammar
xmlns:html="
http://www.w3.org/TR/REC-html40
" xmlns="
http://relaxng.org/ns/structure/1.0
" >
<
div
ns
="http://www.example.com">
<
div
>
<
start
>
<
ref
name
="foo"/>
</
start
>
</
div
>
<
define
name
="foo">
<
element
name
="foo">
<
empty
/>
</
element
>
</
define
>
</
div
>
<
div
/>
</
grammar
>
Valid document:
<foo xmlns="
http://www.example.com
" />
Invalid document:
<foo/>