At 2008-05-05 16:56 +0200, Rory McKinley wrote:
>This may seem to be a silly question (it does to me ;) ) but is there
>any restrictions on where in a relax-ng schema the optional elements
>should appear?
They can appear where you say they can appear.
If you have a content model of:
{ element a { text }, element b { text }?, element c { text } }
... then <b> is optional, but because of the "," operator that
element, when present, must be in sequence between the <a> and the <c>.
>I have a schema with the optional elements mixed in
>amongst the non-optional elements,
But which operator are you using?
>and whenever I try and parse a XML
>files that includes an optional element, the parser complains that it
>was not expecting the optional element.
Then I'm guessing you are using the sequence operator.
>I have run it through two parsers, both complain about the same thing.
>In looking through some examples from documentation, the optional
>elements always seem to appear last in the schema. Is this just a
>coincidence?
Just a co-incidence.
I hope this helps.
. . . . . . . . Ken
--
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:[EMAIL PROTECTED]
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/r/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/r/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal