G. Ken Holman wrote:
>
>
> 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
<snip>
Thanks Ken
You have pretty much confirmed what I thought should happen.
Unfortunately, the reality seems to be different. I have posted snippets
of my code in response to Syd's email, so any input that you can give
based on that would be appreciated.
Regards
Rory