|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 ~ |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Identity Constraint Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|