W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2001

RE: open schema

From: estee <estee@isdn.net.il>
Date: Mon, 27 Aug 2001 16:01:07 -0400 (EDT)
To: "Eddie Robertsson" <eddie@allette.com.au>
Cc: <xmlschema-dev@w3.org>
I hava some problems with the  model you suggest :
	- It requires different namespaces for elements i require and elementss i
do not (ie all elements required must be in a different namespace)
	- It does not work perfectly unless in a sequence (ie ordered) it does not
work inside <all/>
	- It only works for models in which all required elements come first, after
which all "garbage" (non mandatory) elements apprear.
	- It seems (by trial only) that the xml+schema model I have tryed (written
below)  passed validation (but should not have, since a <d> element is not

I have tryed changing the parents minOccures to 2
then, it requires mandatory elements before "garbage" elements (first o,
then d, and then any other)

I hope you get the way i am thinking (I know it night be a bit bizaar)
However, what i want is simple:
	I want to validate that a certain parent element contains some mandatory
fields. I do not however care what else it might contain.
	Additionally, I do not care what is the order of all the elements in the
parent. (some "garbage" elements can occur mixed between mandatory elements)
	I do not even know the quantity of child elements I expect to occur

Thank you very much for your replys
Glad to hear from you
	Oded (estee@isdn.net.il)

<?xml version="1.0" encoding="UTF-8"?>
<a 	xmlns:hey = "hey"
xsi:noNamespaceSchemaLocation="C:\Program Files\Altova\XML Spy
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XML Spy v4.0 beta 2 build Jul 26 2001
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	<xs:element name="a">
			<xs:choice maxOccurs="unbounded">
				<xs:element name="o" type='xs:string' minOccurs='1'/>
				<xs:element name="d" type='xs:string' minOccurs='1'/>
				<xs:any namespace = "hey"/>

-----Original Message-----
From: Eddie Robertsson [mailto:eddie@allette.com.au]
Sent: Monday, August 27, 2001 3:37 AM
To: estee
Cc: xmlschema-dev@w3.org
Subject: Re: open schema

Hi estee,

> Is there any possibility to define (in an xml schema) a type,
> containing only simple types, of which some are required, and all the
> others unknown.In other words: define a type in which i know what
> elements are supposed to be present, but do not know which "might" be
> present. eg:the following type must contain 'a', 'b', and 'c', but
> might also contain some other elements. It is also important to state
> that the order af appearance is of no siginificance.
> <letters>        <a/>        <hollat/>        <c/>
> <club/>        <b/>        <smit/>        <pliq/>    </letters> I am
> searching for a solution in which all elements are of same namespaces.

What you need is to include the xs:any [1] declaration in your content
model. The xs:any declaration is used when you want to include arbitrary
elements in your content model. It lets you control in which namespace
the elements should be defined (using the namespace attribute) and how
the validation should be performed (using the processContents
In your example the declaration of letter would probably be something

<xs:complexType name="letterType">
   <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element name="a" type="xs:string"/>
      <xs:element name="b" type="xs:string"/>
      <xs:element name="c" type="xs:string"/>
      <xs:any namespace="##targetNamespace" processContents="strict"/>

By setting namespace="##targetNamespace" you specify that all the
elements must come from the targetNamespace of your schema.


[1] http://www.w3.org/TR/xmlschema-0/#any
Received on Monday, 27 August 2001 18:00:08 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:52 UTC