[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: [xml] xmllint complains about non-determinist content model



Robin - 

This is the "famed" non-deterministic or ambiguous content model
scenario...  How is the parser supposed to know which content grouping
to validate element "name"  to?  It can't in your scenario.  Even if you
were to use the schmea "group" to abstract your "name/email" grouping,
that would still qualify as non-deterministic.

Is this an inclusive-or example?  If so the best way I have found to do
this, is to represent the:
> 		    <xsd:sequence>
> 			<xsd:element ref="name"/>
> 			<xsd:element ref="email"/>
> 		    </xsd:sequence>

Under another element so your final would like similar to this:
> 	<xsd:element name="person">
> 	    <xsd:complexType>
> 		<xsd:choice>
> 		    <xsd:element ref="name"/>
> 		    <xsd:element ref="email"/>
> 		    <xsd:element name="group">    
		       <xsd:sequence>
> 			   <xsd:element ref="name"/>
> 			   <xsd:element ref="email"/>
> 		       </xsd:sequence>
		    </xsd:element>
> 		</xsd:choice>
> 	    </xsd:complexType>
> 	</xsd:element>

Yes this adds another layer to your scenario but there is no error.

Good luck,
-Marcel


> -----Original Message-----
> From: Robin Munn [mailto:rmunn pobox com]
> Sent: Tuesday, December 23, 2003 1:34 PM
> To: xml gnome org
> Subject: [xml] xmllint complains about non-determinist content model
> 
> I'm trying to write an XML schema that can specify a choice between 
> either element A alone, element B alone, or element A followed by 
> element B. E.g., something like the following:
> 
>     <?xml version="1.0" encoding="UTF-8"?>
>     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> 	<xsd:element name="person">
> 	    <xsd:complexType>
> 		<xsd:choice>
> 		    <xsd:element ref="name"/>
> 		    <xsd:element ref="email"/>
> 		    <xsd:sequence>
> 			<xsd:element ref="name"/>
> 			<xsd:element ref="email"/>
> 		    </xsd:sequence>
> 		</xsd:choice>
> 	    </xsd:complexType>
> 	</xsd:element>
> 	<xsd:element name="name"/>
> 	<xsd:element name="email"/>
>     </xsd:schema>
> 
> But when I try to run this past xmllint, I get the error "Content 
> model of person is not determinist".
> 
> I've been scratching my head over this one for a while. As far as I 
> can tell, that's a deterministic content model. Is there a different 
> way I should be trying to do this?
> 
> Any advice would be much appreciated. xmllint --verion reports:
> 
>     xmllint: using libxml version 20603
>        compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath 
> XPointer
>        XInclude Iconv Unicode Regexps Automata Schemas
> 
> 
> --
> Robin Munn
> rmunn pobox com
> _______________________________________________
> xml mailing list, project page  http://xmlsoft.org/ xml gnome org 
> http://mail.gnome.org/mailman/listinfo/xml
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]