Bonjour à tous,
J'ai un problème en utilisant <key>. J'ai le schema XML suivant d'une entreprise:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.corp.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.corp.com">
<xs:element name="Entreprise">
<xs:complexType>
<xs:sequence>
<xs:element name="nom" type="xs:token"/>
</xs:sequence>
</xs:complexType>
<xs:key name="pk__Entreprise_nom">
<xs:selector xpath="."/>
<xs:field xpath="nom"/>
</xs:key>
</xs:element>
</xs:schema> |
Donc je mets une clé sur le nom de l'entreprise, ensuite je fais un document XML:
1 2 3 4 5
|
<?xml version="1.0" encoding="UTF-8"?>
<Entreprise xmlns="http://www.corp.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.corp.com C:\DOKUME~1\XSD\Entreprise.xsd">
<nom>Hello</nom>
</Entreprise> |
Lorsque je valide mon document XML, celui-ci n'est pas valable et j'ai l'erreur suivante:
"The field(s) 'nom' of the identity constraint 'pk__Entreprise_nom' did not match within the scope of element <Entreprise>"
Pouvez-vous me dire d'où vient cette erreur?
Merci par avance !
Partager