Connecting Tech Pros Worldwide Forums | Help | Site Map

RELAX NG: emulating XSD <any> wildcard with processContents="lax"?

jiffers
Guest
 
Posts: n/a
#1: Feb 5 '07
I'm trying to figure out how to define an element in RNC so that its
contents are validated if a definition matches, othewise no validation
is done.

The example given in the tutorial seems to indicate that you need to
exclude by enumeration all defined attributes and elements:

#this validates all attributes loosely, except for the defined
xml:space attribute
element example {
attribute * - xml:space { text }*,
attribute xml:space { "default" | "preserve" }?
}

What I would like to do is:
element example {
attribute * - xml:* {text}*,
attribute xml:*
}

But this won't parse.


jiffers
Guest
 
Posts: n/a
#2: Feb 5 '07

re: RELAX NG: emulating XSD <any> wildcard with processContents="lax"?


namespace foo = "http://www.w3.org/1999/xhtml"

anyOtherElement =
element * - foo:* { #any element names not in this namespace
attribute * { text }*,
(text
| anyElement)*
}

anyElement = {
anyOtherElement*
& element foo:* #any element names in this
namespace
}

The problem is that the last line is trying to validate against
element names in the namespace, not grammar definitions in the
namespace. How do you refer to all top-level grammars in the schema
without enumerating them? Can you?

Closed Thread