OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] minOccurs maxOccurs doesnt seem to be working correctly in

[ Lists Home | Date Index | Thread Index ]
  • To: Michael Kay <mike@saxonica.com>, 'Paul Spencer' <xml-dev-list@boynings.co.uk>, xml-dev@lists.xml.org
  • Subject: RE: [xml-dev] minOccurs maxOccurs doesnt seem to be working correctly in my schema
  • From: Marielou <marielou_h@yahoo.co.uk>
  • Date: Wed, 14 Jun 2006 17:19:37 +0100 (BST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=OLQrCzeXik/fRqhdT3rhrW6Tp1s2kY9AhHXI4O9ZV4NYntItNQdVrT2fCVAyqcMJGAy6utUSuEBPm6SrmgPdGk47b0gABvpYjUvmxGf7wKsObN4jTjYX2Uu4D9oQDVrEy2TfHlitFNZkyOeBNIqIX+WE0XXDP/fzXzmWfGyfsIk= ;
  • In-reply-to: <014101c68fcb$1f8cebe0$6401a8c0@turtle>

My XML file has format:

<parentA>
 		<C>0</C>
 		<C>1</C>
 		<C>2</C>
 		<C>3</C>
		<C>4</C>
 		<C>5</C>
 		<C>6</C>
 		<C>7</C>
</parentA>

<B> is just an element ref I put in the <all> tag in
<A> to get around the fact that <A> has no sequence
but elements which need to occur more than once. <B>
describes the occurrences of <C> to be more than 1, in
my schema maxOccurs="7" but <B> does not occur in my
XML document

--- Michael Kay <mike@saxonica.com> wrote:

> I don't know what you're doing wrong. But if I copy
> your schema into Stylus
> Studio, and add the XML document
> 
> <?xml version="1.0"?>
> <parentA
>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
xsi:noNamespaceSchemaLocation="file:///c:/temp/test.xsd">
> 	<B>
> 		<C>0</C>
> 		<C>1</C>
> 		<C>2</C>
> 		<C>3</C>
> 		<C>4</C>
> 		<C>5</C>
> 		<C>6</C>
> 		<C>7</C>
> 	</B>
> </parentA>
> 
> then I get the error message (using the Saxon schema
> validator):
> 
> Validation error on line 11 column 6 of
> file:/c:/temp/test.xml:
>   In content of element <B>: The content model does
> not allow element <C> to
> appear here. No
>   further elements are allowed at this position 
> 
> Xerces and the .NET validator also pick up the
> error.
> 
> Michael Kay
> http://www.saxonica.com/
>  
> 
> > -----Original Message-----
> > From: Marielou [mailto:marielou_h@yahoo.co.uk] 
> > Sent: 14 June 2006 16:01
> > To: Marielou; Michael Kay; 'Paul Spencer';
> xml-dev@lists.xml.org
> > Subject: RE: [xml-dev] minOccurs maxOccurs doesnt
> seem to be 
> > working correctly in my schema
> > 
> > Im really having problems specifying the
> occurrences of 
> > elements in my schema without a sequence! I have
> declared 
> > occurrences for child elements in separate content
> models 
> > from the parent A, where maxOccurs for the child
> may be 
> > greater than 1. When I validate a sample XML the
> maxOccurs 
> > and minOccurs isnt working as I hope. e.g. below I
> have 
> > specified maxOccurs for elements in a sequence in
> B, i.e. 
> > element C, to be 7 and minOccurs to be 1, however
> in my 
> > sample XML document I can have over 7 elements or
> even no C 
> > elements passing validation.  
> > 
> > </xs:element>
> > <xs:element name="parentA">
> > <xs:complexType>
> > <xs:all>
> > <xs:element ref="B" minOccurs="1" maxOccurs="1"/>
> </xs:all> 
> > </xs:complexType> </xs:element>
> > 
> > 
> > <xs:element name="B">
> > <xs:complexType>
> > <xs:sequence minOccurs="1" maxOccurs="7">
> <xs:element 
> > name="C"> <xs:simpleType> <xs:restriction
> base="xs:decimal"> 
> > <xs:minInclusive value="0"/> <xs:maxInclusive
> value="8"/> 
> > </xs:restriction> </xs:simpleType> </xs:element> 
> > </xs:sequence> </xs:complexType> </xs:element>
> > 
> > Any help would be greatly appreciated!
> > 
> > Marie Louise
> > 
> > Send instant messages to your online friends 
> > http://uk.messenger.yahoo.com 
> > 
> >
>
-----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org 
> > <http://www.xml.org>, an initiative of OASIS 
> > <http://www.oasis-open.org>
> > 
> > The list archives are at
> http://lists.xml.org/archives/xml-dev/
> > 
> > To subscribe or unsubscribe from this list use the
> subscription
> > manager:
> <http://www.oasis-open.org/mlmanage/index.php>
> > 
> 
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS