[
Lists Home |
Date Index |
Thread Index
]
Tim Bray wrote:
> Suppose in a RelaxNG schema (compact syntax) I have
>
> default namespace eg = "http://example.com/"
> namespace noNS = ""
>
> I'm writing a schema for something that will serve as a container, and I
> have an element for which I want to say "This can contain mixed content
> of more or less any elements/attributes with the constraint that no
> elements may be unqualified (noNS above), and no elements or attributes
> can be in my namespace ("eg" above).
You've got three kinds of elements here:
1) container elements in the eg namespace
2) children of container elements; let's call these border elements
3) descendants of the border elements; let's call these interior elements
If I have understood correctly, you want border elements not to be
unqualified and not to be in the eg namespace. What about interior
elements? I suspect you *do* want to allow those to be unqualified.
Assuming:
- container elements must not have any unqualified attributes
- container elements must not have any attributes in the eg namespace
- border elements must not have attributes in the eg namespace
- border elements must not be in the eg namespace
- border elements must not be unqualified
- interior elements must not have attributes in the eg namespace
- interior elements must not be in the eg namespace
- interior elements may be unqualified
you could write the schema like this:
namespace eg = "http://www.example.com"
namespace noNS = ""
interior =
element * - eg:* {
attribute * - eg:* { text }*,
(interior|text)*
}
border =
element * - (eg:*|noNS:*) {
attribute * - eg:* { text }*,
(interior|text)*
}
container =
element eg:container {
attribute * - (eg:*|noNS:*) { text }*,
(border|text)*
}
James
|