Re: Inconsistent Validation - mixed content and group

Todd,

While I don't quite follow what purpose the group "g1" serves (it seems
to me the schema would be identical with or without it, but perhaps your
actual usage requires this kind of structure), the schema is perfectly
fine and the instance document is schema valid.  I have visually
inspected this and made use of XercesJ to confirm.  You can use the
online XercesJ schema validator available at:

http://tools.decisionsoft.com/

to check simple schema/instance pairs.

I would note that XSDL (and in fact any schema) will have limited
use when you get into mixed content -- basically it is very difficult to
sensibly validate the mixed content portions of an XML document.  If it
is possible to avoid mixed content, then it is best to do so -- you can
only expect useful schemas for regular structures or "leaf nodes" with
well defined content.

Regards,

Ian.


On Tue, May 28, 2002 at 05:23:28AM -0400, Winchel 'Todd' Vincent III wrote:
> I have attempted to validate the xml instance with the following schema
> (below) in:
> 
> MSXML 4.0 (successfully)
> MSXML 4.0 SP1 (successfully)
> XML Spy 4.2 (successfully)
> XML Spy 4.3 (*un*successfully)
> XML Spy 4.4 (*un*successfully)
> 
> I think the problem is with the combination of using mixed="true" and one or
> two layers of groups.  Either I have not found, or do not understand the
> specification on what is correct or not.  I would like for the instance
> document below to be valid against this schema, as I have a number of schema
> that use this construct.
> 
> In any case, validation in the products above are inconsistent.  I have not
> tried anything else.  I hope that XML Spy 4.3 and 4.4 simply have a bug, in
> which case, I also hope the bug will be fixed in a future version.
> 
> Any help or advice would be appreciated.
> 
> Thanks,
> 
> Todd
> 
> ======================
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="urn:a"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:a"
> elementFormDefault="qualified">
>  <xsd:complexType name="a" mixed="true">
>   <xsd:choice>
>    <xsd:group ref="g1" minOccurs="0" maxOccurs="unbounded"/>
>   </xsd:choice>
>  </xsd:complexType>
>  <xsd:group name="g1">
>   <xsd:choice>
>    <xsd:group ref="g2"/>
>   </xsd:choice>
>  </xsd:group>
>  <xsd:group name="g2">
>   <xsd:choice>
>    <xsd:element ref="x" maxOccurs="unbounded"/>
>    <xsd:element ref="y" maxOccurs="unbounded"/>
>   </xsd:choice>
>  </xsd:group>
>  <xsd:element name="a" type="a"/>
>  <xsd:element name="y" type="xsd:string"/>
>  <xsd:element name="x" type="xsd:string"/>
> </xsd:schema>
> 
> =======================================
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:a"
> xsi:schemaLocation="urn:a a2.xsd">
>  <x>content</x>
>  <y>content</y>
>  content <y/>
>  <y>content</y>content <y/>
>  <y>content</y>content<y/>
>  <y>content</y>
>  <y/>
> </a>
> 
> 
> 
> 
> 

-- 
Ian Stokes-Rees, Client Services      DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com

Received on Wednesday, 29 May 2002 05:32:38 UTC