schema problem 2003-03-05 - By Bob Schloss
Denis,
Your schema contains what is known as an ambiguous content model, because when a streaming processor found ELEMENT_1 in an instance document, it wouldn't know if that matched the particle for the first branch of the choice or the particle for the second branch of the choice.
It is a good idea to check any schema you write with special tools which do 100% checking of XML Schemas to make sure they conform to every one of the constraints built into W3C XML Schema (many of which can't be detected just by validating the syntax of the XML Schema documents). One tool (which I did some work on) is the IBM XML Schema Quality Checker. You can find it at http://www.alphaworks.ibm.com/tech/xmlsqc .
Good luck, Bob
Bob Schloss XML/XSL Transformational Systems IBM T. J. Watson Research Center Yorktown Heights, New York, USA
Denis McCarthy <dmccarthy@(protected) To: xerces-j-user@(protected) .apache.org ie> cc: Subject: schema problem 03/05/2003 12:03 PM Please respond to xerces-j-user
Hi there I'm having a problem with some schema validation rules. I want to allow one of two sequences to be present in an xml document (I'd prefer not to have to use sequences, but I don't think I can use <xsd:all within an xsd:choice tag). However, the following xsd code rule only seems to allow the FIRST sequence to be validated correctly - when I send an xml doc with the second sequence type I get the following SAXParseTypeException: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content starting with element 'ELEMENT_3' . The content must match '((("":ELEMENT_1),("":ELEMENT_2))|((("":ELEMENT_1){0-1},("":ELEMENT_3)),("":
ELEMENT_4)))'. As far as I can see, the content does match this. Can anyone see a problem with this schema?
<xsd:choice> <xsd:sequence> <xsd:element name="ELEMENT_1" type="TYPE_1"/> <xsd:element name="ELEMENT_2" type="TYPE_2"/> </xsd:sequence> <xsd:sequence> <xsd:element name="ELEMENT_1" type="TYPE_1" minOccurs="0"/> <xsd:element name="ELEMENT_3" type="TYPE_3"/> <xsd:element name="ELEMEMT_4" type="TYPE_4"/> </xsd:sequence> </xsd:choice>
Thanks Denis
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify your system administrator.
This footnote also confirms that this email message has been checked for the presence of computer viruses.
www.fexco.com **********************************************************************
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|