validating a XML file using XSD 1.1 with Xerces-J

Roberto Marabini <[email protected]>
Newsgroups gmane.text.xml.xerces-j.user
Message-ID <CAF8w2sZ45Fk+GL14xtqNuDVZOLvF+57M83MfpRcOT5TrhsR_mg@mail.gmail.com>
Hi,

    I am trying to write a XSD 1.1 schema that uses  XSD 1.1
assertions. I am able to repeat the examples described in the URL:
http://mukulgandhi.blogspot.com.es/2009/11/xsd-11-some-xsd-11-samples-running-with.html
so I guess my xerces-j installation is OK.

   When I tried to include an assert in my schema (I reproduce part of
it in the email and attach the full file) I got the error message:

[Error] kk.emx:33:14: cvc-assertion.3.13.4.1: Assertion evaluation
('defocusU ge defocusV') for element 'particle' with type '#anonymous'
did not succeed.

but defocusU is indeed greater than defocusV

Note that the commented lines

<!-- <xsd:assert test="t34 le 3" />-->
<!-- <xsd:assert test="@index le 3" />-->

work properly when uncommented

but

        <xsd:assert test="defocusU ge defocusV" />

does not. I guess the problem is that defocusU and defocusV are complextypes

any help will be welcomed

    thanks

               Roberto
=================

Schema

<?xml version="1.1" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">

...............
...............
..............

<xsd:element name="EMX">
    <xsd:complexType>
      <xsd:sequence>
	
      <xsd:element name="micrograph" type="microType"
maxOccurs="unbounded" minOccurs="0"/>

      <xsd:element name="particle" maxOccurs="unbounded" minOccurs="0">
	    <xsd:complexType>
	      <xsd:all>
	        <xsd:element name="defocusU" type="defocusType"
maxOccurs="1" minOccurs="0"/>
	        <xsd:element name="defocusV" type="defocusType" maxOccurs="1"
minOccurs="0"/>
	        <xsd:element name="defocusUAngle" type="angleType"
maxOccurs="1" minOccurs="0"/>


	        <xsd:element name="micrograph" maxOccurs="1" minOccurs="0">
	          <xsd:complexType>
		         <xsd:simpleContent>
		             <xsd:extension base="xsd:string">
		                 <xsd:attribute name="fileName" type="xsd:string"
use="required"/>
		                 <xsd:attribute name="index" type="xsd:integer"/>
		             </xsd:extension>
		         </xsd:simpleContent>
	          </xsd:complexType>
	        </xsd:element>
	
            <xsd:element name="activeFlag"
type="xsd:nonNegativeInteger" maxOccurs="1" minOccurs="0"/>
	        <xsd:element name="boxSize" maxOccurs="1" minOccurs="0">
	          <xsd:complexType>
		        <xsd:all>
		          <xsd:element name="X" type="boxSizeType" maxOccurs="1"
minOccurs="1"/>
		          <xsd:element name="Y" type="boxSizeType" maxOccurs="1"
minOccurs="1"/>
		        </xsd:all>
	          </xsd:complexType>
	        </xsd:element>

	        <xsd:element name="centerCoord" maxOccurs="1" minOccurs="0">
	          <xsd:complexType>
		        <xsd:all>
		          <xsd:element name="X" type="coordType" maxOccurs="1" minOccurs="1"/>
		          <xsd:element name="Y" type="coordType" maxOccurs="1" minOccurs="1"/>
		        </xsd:all>
	          </xsd:complexType>
	        </xsd:element>
	
            <xsd:element name="fom" type="decimalBTzeroANDone"
maxOccurs="1" minOccurs="0"/>
	        <xsd:element name="pixelSpacing" maxOccurs="1" minOccurs="0">
	          <xsd:complexType>
		        <xsd:all>
		          <xsd:element name="X" type="samplingType" maxOccurs="1"
minOccurs="1"/>
		          <xsd:element name="Y" type="samplingType" maxOccurs="1"
minOccurs="1"/>
		        </xsd:all>
	          </xsd:complexType>
	        </xsd:element>

	        <xsd:element name="transformationMatrix" maxOccurs="1" minOccurs="0">
	          <xsd:complexType>
		        <xsd:all>
		          <xsd:element name="t11" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t12" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t13" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t14" type="transformationType"
maxOccurs="1" minOccurs="0"/>
		          <xsd:element name="t21" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t22" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t23" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t24" type="transformationType"
maxOccurs="1" minOccurs="0"/>
		          <xsd:element name="t31" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t32" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t33" type="xsd:double" maxOccurs="1"
minOccurs="0"/>
		          <xsd:element name="t34" type="transformationType"
maxOccurs="1" minOccurs="0"/>
		        </xsd:all>
              <!-- <xsd:assert test="t34 le 3" />-->
	          </xsd:complexType>
	        </xsd:element>
	
	      </xsd:all>
	      <xsd:attribute name="fileName" type="xsd:string" use="required"/>
	      <xsd:attribute name="index" type="xsd:integer"/>
        <!-- <xsd:assert test="@index le 3" />-->
        <xsd:assert test="defocusU ge defocusV" />
	    </xsd:complexType>
    </xsd:element>
	
    </xsd:sequence>
    <xsd:attribute name="version" type="numVersion" use="required"/>
  </xsd:complexType>
</xsd:element>

</xsd:schema>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
emx.xsd (application/octet-stream, 9.2 KB) - not displayed
kk.emx (application/octet-stream, 2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.