W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2000

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

From: Michael Anderson <michael@research.canon.com.au>
Date: Thu, 07 Dec 2000 09:10:36 +1100
Message-ID: <3A2EB95C.783CFB22@research.canon.com.au>
To: Michael Burns <Michael.Burns@sas.com>
Cc: "'Don Mullen'" <donmullen@tibco.com>, "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>, xmlschema-dev@w3.org
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:10:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:19 GMT