XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 12th, 2003, 02:19 PM
Vmusic Vmusic is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 85 Vmusic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 m 22 sec
Reputation Power: 8
Identity Constraint Problem

Hi,
I have a schema and xml file below. There is a key constraint on the element 'person' that says the element 'person_id' should be a key. The XML document has 2 persons both with the same value for the element person_id - This should not be valid I believe.....

Can someone explain why this key constraint isn't working?

(I hope these get displayed since there's tags here)
Thanks,
Vmuisc

---------------------SCHEMA----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by William Gattis (MSBS) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="persons">
<xs:complexType>
<xs:sequence>
<xs:element name="person" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="first_nm"/>
<xs:element name="last_nm"/>
<xs:element name="person_id" type="xs:integer"/>
</xs:all>
</xs:complexType>
<xs:key name="personKey">
<xs:selector xpath="."/>
<xs:field xpath="person_id"/>
</xs:key>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

-------------------- SAMPLE XML INSTANCE -----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<persons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\a_work\junk_schemas\integrity constraints\persons.xsd">
<person>
<first_nm>Billy</first_nm>
<last_nm>Bob</last_nm>
<person_id>1</person_id>
</person>
<person>
<first_nm>Person</first_nm>
<last_nm>Two</last_nm>
<person_id>1</person_id>
</person>
</persons>

<!-- as you can see the value for person_id is the same and this should be invlaid , but I don't get any validation errros --->


<Thanks A Bunch/>
__________________
~Just Say When ~

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Identity Constraint Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway