में अद्वितीय मान निर्दिष्ट करने के लिए कैसे मैं xs प्राप्त करने में असमर्थ हूं: XML फ़ाइल में काम करने के लिए अद्वितीय विनिर्देशक। मैं बस काम करता है कि एक XPath काम करने में सक्षम नहीं लगता है। इस सवाल में कोड की मात्रा के लिए मेरी क्षमा है, लेकिन मैं किसी के लिए बहुत आभारी हूं जो बता सकता है कि मैं नीचे क्या कर रहा हूं। कोई फर्क नहीं पड़ता कि मैं क्या करता हूं, मुझे तत्व में @ref विशेषता नहीं मिल सकती है ताकि मेरे डुप्लिकेटिंग मूल्य (प्रत्येक रेफरी अद्वितीय हो) के लिए त्रुटि की रिपोर्ट हो।किसी XML स्कीमा
जानकारी के लिए कोई भी मदद या पॉइंटर्स बहुत ही आभारी होंगे।
तरह चाहता है, पैट्रिक
यह मेरा स्कीमा है:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Artworks"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:aw="http://www.fourthwish.co.uk/data/Artworks.xsd"
xmlns="http://www.fourthwish.co.uk/data/Artworks.xsd"
targetNamespace="http://www.fourthwish.co.uk/data/Artworks.xsd"
elementFormDefault="qualified"
>
<xs:element name="artworks">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="artwork" type="ArtworkType">
<xs:unique name="uniqueRef">
<xs:selector xpath="artwork"/>
<xs:field xpath="@ref"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="ArtworkType">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
</xs:sequence>
<xs:attribute name="ref" type="xs:nonNegativeInteger"/>
</xs:complexType>
</xs:schema>
और ये मेरे एक्सएमएल फ़ाइल है:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<artworks
xmlns="http://www.fourthwish.co.uk/data/Artworks.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.fourthwish.co.uk/data/Artworks.xsd Artworks.xsd"
>
<artwork ref="1">
<title>Title String</title>
</artwork>
<artwork ref="1">
<title>Title String</title>
</artwork>
</artworks>
मैं डुप्लिकेट रेफरी के लिए एक त्रुटि क्यों नहीं मिल सकता मान? Arrrggghhh! मैंने इंटरनेट पर सब कुछ पढ़ा है। कृपया किसी की मदद करें।