Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Understanding Dawns! But 1 More Question About Keys/Refs...

From: "Jim Stanley" <JimS@--------------.--->
To: <xmlschema-dev@--.--->
Date: 7/30/2004 9:30:00 AM
George and Michael,

Thanks *so* much!  The clouds have miraculously parted and I'm finally
able to get my schema validating.

One more question:

I don't seem to be able to create one-to-many validation of my keys,
which is a problem because more than one keyed element may occur in a
given sequence:

<xs:complexType name="schedActivity">
	<xs:sequence>
		<xs:element name="activityID" type="xs:int"/>
	</xs:sequence>
</xs:complexType>

Zero to infinite of those schedActivities need to go in the following:
<xs:complexType name="dayBucket">
	<xs:sequence>
		<xs:element name="dayNumber" type="xs:int"/>
		<xs:element name="activityRef" type="xs:int"
minOccurs="0" maxOccurs="unbounded"/>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="prodSchedule">
	<xs:sequence>
		<xs:element name="schedName" type="xs:string"/>
		<xs:element name="dayBucket" type="dayBucket"
minOccurs="0" maxOccurs="unbounded"/>
	</xs:sequence>
</xs:complexType>

I've defined my high-level keys and keyrefs as follows (assume
"document" owns all the above):

<xs:key name="schedActivity.PK">
	<xs:selector xpath="schedActivity"/>
	<xs:field xpath="activityID"/>
</xs:key>

<xs:keyref name="schedDayActivity.FK" refer="schedActivity.PK">
	<xs:selector xpath="prodSchedule/dayBucket"/>
	<xs:field xpath="activityRef"/>
</xs:keyref>

If I try something like the following in my XML:

<schedActivity>
  <activityID>1</activityID>
</schedActivity>
<schedActivity>
  <activityID>2</activityID>
</schedActivity>
<prodSchedule>
  <schedName>My Schedule</schedName>
  <dayBucket>
    <dayNumber>1</dayNumber>
    <activityRef>1</activityRef>
    <activityRef>2</activityRef>
  </dayBucket>
<prodSchedule>

XMLSpy tells me that the foreign key has to evaluate to exactly 0 or 1
node.  I need 1 to unbounded, and I also need to make sure that any
activityRef elements have a reference to a declared schedActivity
object.  What am I missing?

Thanks again,

Jim Stanley
Media Services, Inc.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent