[
Lists Home |
Date Index |
Thread Index
]
Thomas B. Passin scripsit:
> You also do not have a hope of getting the WXS schema right without a tool
> to help, at least not for one with any complexity. I'm not sure if the same
> is true for RelaxNG. John? What do you say?
Well, what counts as a tool? I certainly run every RNG schema that I
write through Jing in its schema-checking mode (just don't specify any
document to validate), and generally find a typo or two and sometimes
a violation of an RNG rule, generally of the paper-bag variety.
But I write them all in a plain text editor with no special support.
If I were writing XML-syntax schemas, I would certainly use
Henry Thompson's wonderful XED editor, which is basically a plain text
editor that forces the document to be well-formed.
OTOH, when developing my complete XLink schema (which validates a
document if and only if it conforms to XLink) I had to do lots of
Jing passes until I got something that did what I wanted and
was semantically allowed. But XLink is a very unusual schema
with extensive use of wildcards.
I'll publish it here just for s**ts and giggles. There may be
undetected semantic problems, use at your own risk, I claim no
copyright.
=====cut here=====
# RELAX NG schema for W3C XLink
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
namespace xlink = "http://www.w3.org/1999/xlink"
href = attribute xlink:href {xsd:anyURI}
role = attribute xlink:role {xsd:anyURI}
arcrole = attribute xlink:arcrole {xsd:anyURI}
title.att = attribute xlink:title {text}
show = attribute xlink:show {"new"|"replace"|"embed"|"other"|"none"}
actuate = attribute xlink:actuate {"onLoad"|"onRequest"|"other"|"none"}
label = attribute xlink:label {xsd:NMTOKEN}
from = attribute xlink:from {xsd:NMTOKEN}
to = attribute xlink:to {xsd:NMTOKEN}
simple = element * {
attribute xlink:type {"simple"}, anyAttr*,
href?, role?, arcrole?, title.att?, show?, actuate?,
(anyElem | text)*
}
extended = element * {
attribute xlink:type {"extended"}, anyAttr*,
role?, title.att?,
(title | resource | locator | arc | anyElem | text)*
}
title = element * {
attribute xlink:type {"title"}, anyAttr*,
(anyElem | text)*
}
resource = element * {
attribute xlink:type {"resource"}, anyAttr*,
role?, title.att?, label?,
(anyElem | text)*
}
locator = element * {
attribute xlink:type {"locator"}, anyAttr*,
href, role?, title.att?, label?,
(title | anyElem | text)*
}
arc = element * {
attribute xlink:type {"arc"}, anyAttr*,
arcrole?, title.att?, show?, actuate?, from?, to?,
(title | anyElem | text)*
}
start = element * { anyAttr*, (simple | extended | anyElem)* }
anyElem = element * {anyAttr*, (anyElem | text)*}
anyAttr = attribute * - xlink:* {text}
=====cut here=====
--
John Cowan <jcowan@reutershealth.com> http://www.reutershealth.com
I amar prestar aen, han mathon ne nen, http://www.ccil.org/~cowan
han mathon ne chae, a han noston ne 'wilith. --Galadriel, _LOTR:FOTR_
|