[
Lists Home |
Date Index |
Thread Index
]
On Thu, 2004-03-18 at 13:14, Pedro Salazar wrote:
> Greetings,
>
> I'm getting a validation error depending of the declaration of my
> elements are local or global.
>
> For instance, this sample xml:...
> is reporting this error:
>
> error:cvc-complex-type.2.4.a: Invalid content starting with element 'a'.
> The content must match '((("":a)|("":b)))
>
> The schema is:...
>
> If I replace my local elements declarations, a and b, and use the
> declaration by ref (using the commented code) it works fine.
>
> Why is that happens?
You don't show enough of the schema, or of the instance,
for me to be sure, but if I had to guess on the basis of
the information you provide, I'd guess
- your schema has the default setting of
elementFormDefault='unqualified'
- in the instance, your local elements are unprefixed
- in the instance, your local elements are
inheriting a default namespace from a surrounding
element
- therefore, in the instance your local elements are
qualified, but their declarations are unqualified
I'd change the elementFormDefault on the schema element
to 'qualified' if I were you. (Other people, of course,
swear that you should never have qualified locals, only
unqualified. I think they're crazy, but some of them are
very smart, so maybe they're right and I'm wrong on the
Right Way to Write Schemas. The fact that we couldn't
agree on a single Right Way, of course, is why the
elementFormDefault attribute exists in the first place.
No one liked the idea -- but everyone thought it was
better than having the decision go The Wrong Way.)
Just my two cents,
-Michael Sperberg-McQueen
W3C
|