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 Burns <Michael.Burns@sas.com>
Date: Wed, 6 Dec 2000 16:55:59 -0500
Message-ID: <764CA2FF49EC054BA086FC8253A52DD7624DF7@merc09.us.sas.com>
To: "'Don Mullen'" <donmullen@tibco.com>, "'ht@cogsci.ed.ac.uk'" <ht@cogsci.ed.ac.uk>
Cc: xmlschema-dev@w3.org
Still does not work.  Gee, I thought this was a simple request :*)

Here is my instance:
- - - snip - - - 

<Properties xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" 
               xsi:noNamespaceSchemaLocation="Useless6.xsd"
   Name="" Rank="" SerialNumber="" 
  >
	<Cat/>
	<Dog/>
	<Zebra/>
</Properties>

/- - - snip - - -


and here is my schema:
- - - snip - - - 

<?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 minOccurs="0" maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:anyAttribute/>
  </xs:complexType>
</xs:element>

</xs:schema>

/- - - snip - - -

Here is what xsv says:
- - - 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

file:/C:/ModelCompilerTestPen/test/xmlout/Properties.xml:6:2: Invalid per src-resolve: can't find a type for wildcard-matching element {None}:Dog

file:/C:/ModelCompilerTestPen/test/xmlout/Properties.xml:7:2: Invalid per src-resolve: can't find a type for wildcard-matching element {None}:Zebra

/- - - snip - - -

And XML Spy says:  Unexpected attribute 'Name' in element 'Properties'

And Oracle's schema validating parser says: 
- - - snip - - -
Parsing Properties.xml

<Line 4, Column 32>: XSD-2026: (Error) Invalid attribute 'mixed' in element 'complexType'

<Line 5, Column 8>: XSD-2034: (Error) Element 'Cat' not expected.
<Line 6, Column 8>: XSD-2034: (Error) Element 'Dog' not expected.
<Line 7, Column 10>: XSD-2034: (Error) Element 'Zebra' not expected.
Parser Exception: Element 'Cat' not expected.

/- - - snip - - -

-----Original Message-----
From: Don Mullen [mailto:donmullen@tibco.com]
Sent: Wednesday, December 06, 2000 3:28 PM
To: 'ht@cogsci.ed.ac.uk'; Michael.Burns@sas.com
Cc: xmlschema-dev@w3.org
Subject: RE: how to define an element which can contain any attributes
or elements



Needs the sequence + unbounded:

<xs:element name="Properties">
  <xs:complexType mixed="true">
   <xs:sequence>
   	<xs:any minOccurs="0" maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:anyAttribute/>
  </xs:complexType>
</xs:element>

> -----Original Message-----
> From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
> Sent: Wednesday, December 06, 2000 4:06 PM
> To: Michael.Burns@sas.com
> Cc: xmlschema-dev@w3.org
> Subject: Re: how to define an element which can contain any attributes
> or elements
> 
> 
> Michael Burns <Michael.Burns@sas.com> writes:
> 
> > I want to define an element called "Properties" so that it can have
> > any attributes and any elements.
> 
> <xs:element>
>  <xs:complexType mixed="true">
>   <xs:any minOccurs="0" maxOccurs="0"/>
>   <xs:anyAttribute/>
> </xs:element>
> 
> Customise to taste.
> 
> ht
> -- 
>   Henry S. Thompson, HCRC Language Technology Group, 
> University of Edinburgh
>           W3C Fellow 1999--2001, part-time member of W3C Team
>      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 
> 131 650-4440
> 	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
> 		     URL: http://www.ltg.ed.ac.uk/~ht/
> 
Received on Wednesday, 6 December 2000 16:56:47 GMT

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