RE: how to define an element which can contain any attributes or elements

That did the trick, thanks.
XMLSpy still has a problem with the attributes, but I'll take that
up with them offline. 

-----Original Message-----
From: Michael Anderson [mailto:michael@research.canon.com.au]
Sent: Wednesday, December 06, 2000 4:11 PM
To: Michael Burns
Cc: 'Don Mullen'; 'ht@cogsci.ed.ac.uk'; xmlschema-dev@w3.org
Subject: Re: how to define an element which can contain any attributes
or elements


Michael Burns wrote:

> Still does not work.  Gee, I thought this was a simple request :*)
>
> - - - snip - - -
> Problems with the schema-validity of the target
> file:/C:/ModelCompilerTestPen/test/xmlout/Properties.xml:5:2: Invalid per src-resolve: can't find a type for wildcard-matching element {None}:Cat

< snip >

The <any> and <anyAttribute> wildcard just mean you can have any globally declared element in the content model or any globally declared attribute.  So
you still need to declare Cat, Dog etc globally.  The processor is trying to resolve Cat etc and can't find it so throws an error.  This is actually
because the default level of validation is "strict" which means the processor is _required_ to resolve Cat etc.  To fix this to what you want, try set
processContents = "lax" or even "skip". ie

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2000/10/XMLSchema" elementFormDefault="qualified">
<xs:element name="Properties">
  <xs:complexType mixed="true">
   <xs:sequence>
        <xs:any processContents = "lax" minOccurs="0" maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:anyAttribute processContents = "lax"/>
  </xs:complexType>
</xs:element>

</xs:schema>

The processor should (I think) now only try to validate Cat, Dog etc _if_and_only_if_ it can resolve it, otherwise don't worry.

mick.

ps.  Can you reply email to me to tell me if this works as I am currently trying to understand exactly what "lax" means myself.  cheers.

Received on Wednesday, 6 December 2000 17:29:56 UTC