Are there tools that will help me debug a complex assertion?  I've tried using 
trace, but it doesn't seem to print out messages when it's inside an 'every' or 
a 'some'.   I've attached the example I'm trying to debug.  The assertion in 
line 26 of the schema should reject the <transition> in line 7 of sample.scxml, 
but it doesn't (so validation succeeds).  I can't tell if there's a logical 
error in my schema, or if I'm not using some element correctly.  Can someone 
give me some hints on how to debug the assertion's application?

Thanks in advance,
Jim Barnett

Attachment: sample.scxml
Description: sample.scxml

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://www.w3.org/2005/07/scxml";
    xmlns="http://www.w3.org/2005/07/scxml";
    elementFormDefault="qualified">
	

	<!-- scxml -->
	<xsd:attributeGroup name="scxml.scxml.attlist">
		<xsd:attribute name="initial" type="xsd:IDREFS"/>
		<xsd:attribute name="version" type="xsd:decimal" use="required" fixed="1.0"/>
	</xsd:attributeGroup>
	<xsd:group name="scxml.scxml.mix">
		<xsd:choice>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.scxml.content">
		<xsd:sequence>
			<xsd:group ref="scxml.scxml.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.scxml.type">
		<xsd:group ref="scxml.scxml.content"/>
		<xsd:attributeGroup ref="scxml.scxml.attlist"/>
		<xsd:assert test="every $tr in .//transition satisfies  
			(every $target1 in tokenize(string($tr/@target), '\s+') satisfies (
			some $ancestor in (.//state | .//parallel | .//final) satisfies (
			(($ancestor/@id = $target1) and 
			(not(some $descendant in ($ancestor//state | $ancestor//final | $ancestor//parallel)
			satisfies (some $target2 in tokenize(string($tr/@target), 's+') satisfies (
      $descendant/@id = $target2))))))))"  
			xpathDefaultNamespace="##targetNamespace"/>
	</xsd:complexType>
	<xsd:element name="scxml" type="scxml.scxml.type"/>

	<!-- state -->
	<xsd:attributeGroup name="scxml.state.attlist">
		<xsd:attribute name="id" type="xsd:ID"/>
		<xsd:attribute name="initial" type="xsd:IDREFS"/>
	</xsd:attributeGroup>
	<xsd:group name="scxml.state.mix">
		<xsd:choice>
			<xsd:element ref="transition" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.state.content">
		<xsd:sequence>
			<xsd:group ref="scxml.state.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.state.type">
		<xsd:sequence>
			<xsd:group ref="scxml.state.content"/>
		</xsd:sequence>	
		<xsd:attributeGroup ref="scxml.state.attlist"/>		
	</xsd:complexType>
	<xsd:element name="state" type="scxml.state.type"/>


	<!-- transition -->
	<xsd:attributeGroup name="scxml.transition.attlist">
		<xsd:attribute name="target" type="xsd:IDREFS"/>
	</xsd:attributeGroup>
<xsd:group name="scxml.transition.mix">
		<xsd:choice>
			<xsd:element ref="transition" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:element ref="state" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:choice>
	</xsd:group>
	<xsd:group name="scxml.transition.content">
		<xsd:sequence>
			<xsd:group ref="scxml.transition.mix" minOccurs="0" maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:group>
	<xsd:complexType name="scxml.transition.type">
			<xsd:sequence>
			<xsd:group ref="scxml.transition.content"/>
		</xsd:sequence>	
		<xsd:attributeGroup ref="scxml.transition.attlist"/>
	</xsd:complexType>
	<xsd:element name="transition" type="scxml.transition.type"/>


</xsd:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to