You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "SORENS,MICHAEL (HP-Boise,ex1)" <mi...@hp.com> on 2003/01/28 00:09:06 UTC

Schema validation problem

I am new to Xerces, and I am trying a simple test. using the sample
dom.Counter program to see if it can validate my test file. 
(1) XmlSpy is able to validate my file, but Xerces reports a couple errors.
Does that mean that XmlSpy is less stringent in its checking?

(2) My schema imports the Xhtml namespace and uses elements within it. But
Xerces seems to be mixing up my namespace with the xhtml namespace with this
error:
[Error] xxx.xml:4:12: cvc-complex-type.2.4.a: Invalid content starting with
element 'cc:title'. The content must match
'(("http://www.w3.org/1999/xhtml":meta){0-UNBOUNDED})'.

(3) The other Xerces-reported error I don't quite follow:
[Error] xxx.xsd:21:30: cos-all-limited.1.2: An ''all'' model group must
appear in a particle with '{'min occurs'}'='{'max occurs'}'=1, and that
particle must be part of a pair which constitutes the '{'content type'}' of
a complex type definition.

Any assistance fixing these would be appreciated.


My xml file is quite short:
=========================
<cc:codingRulesDoc xmlns:cc="clean.com" xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="clean.com xxx.xsd">
<cc:head>
	<cc:title>Guidelines</cc:title>
	<cc:id>$Id: cd1.xml,v 1.0 2002-11-09 10:35:48-07 delll Exp delll
$</cc:id>
	<cc:version>$Revision: 1.0 $</cc:version>
	<meta name="description" content="guidelines"/>
	<meta name="keywords" content="guidelines, rules, coding
conventions, coding standards"/>
</cc:head>
<cc:body>
<p>sample text here...</p>
</cc:body>
</cc:codingRulesDoc>
=========================

The xsd file is about a hundred lines so I'll only paste a portion which is
relevant to the above two errors:
=========================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="clean.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="clean.com"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/1999/xhtml"
schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"/>
<xs:element name="codingRulesDoc">
. . .
	<xs:element name="head">
		<xs:annotation>
			<xs:documentation>Corresponds to html
'head'</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:group ref="ccHead" />
				<xs:element ref="xhtml:meta" minOccurs="0"
maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:group name="ccHead" >
		<xs:all >
			<xs:element name="title" type="NonEmptyString"/>
			<xs:element name="id" type="NonEmptyString"
minOccurs="0"/>
			<xs:element name="version" type="NonEmptyString"
minOccurs="0"/>
			<xs:element name="ignore" type="xs:anyType"
minOccurs="0"/>
		</xs:all>
	</xs:group>
. . .


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org