Re: Attributes and Default Namespaces

On Fri, Nov 12, 2010 at 12:30 PM, Mukul Gandhi <gandhi.mukul@gmail.com> wrote:
> <xs:element name="Results">
>     <xs:annotation>
>         <xs:documentation>Comment describing your root
> element</xs:documentation>
>     </xs:annotation>
> </xs:element>

There is a slight correction I want to make to what I wrote earlier.
For an XML schema fragment like above the schema type of element
"Results" is indeed xs:anyType. But if there is an "non null"
targetNamespace attribute on xs:schema instruction, in such a schema I
think a compliant XML Schema validator must report validation errors
(as you originally got -- so that was correct I think). This is so
because, if in instance document we have something like:

<Results xmlns="http://raid.raidllp.com">
    ...
</Results>

then the schema validator won't be able to find an element declaration
for element "Results" (in the specified namespace), since the schema
type of "Results" must be in namespace http://raid.raidllp.com (but
for an element declaration like <xs:element name="Results" /> the
schema type is xs:anyType and this is in namespace
http://www.w3.org/2001/XMLSchema).




-- 
Regards,
Mukul Gandhi

Received on Saturday, 13 November 2010 01:49:47 UTC