xml - Unique simple type element in parent complex type element -


i wish add unique constraint name element of familyconvention complex type. reason, schema below not detect duplicated names:

<xs:element name="validatedconvention">    <xs:complextype>       <xs:sequence>         <xs:element name="family" type="familyconvention" minoccurs="1" maxoccurs="unbounded"/>       </xs:sequence>     </xs:complextype>     <xs:unique name="keyfamilyname">                     <xs:selector xpath="family/name"/>                   <xs:field xpath="."/>     </xs:unique> </xs:element> <xs:complextype name="familyconvention">     <xs:sequence>         <xs:element name="name" minoccurs="1" maxoccurs="1">             <xs:simpletype>                 <xs:restriction base="xs:string">                     <xs:pattern value="([a-za-z0-9])+" />                 </xs:restriction>             </xs:simpletype>         </xs:element>     </xs:sequence> </xs:complextype> 

compare xml:

<validatedconvention">     <family>         <name>john</name>     </family>                <family>         <name>john</name>     </family> </validatedconvention > 

do see what's problem schema?

thanks answers!

my original namespace details were:

xml:

<validatedconvention xmlns="dnx_ns" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="dnx_ns file:///c:/users/summer/workspace/project1/newxmlschema.xsd "> 

schema:

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" targetnamespace="dnx_ns" xmlns="dnx_ns" elementformdefault="qualified"> 

were wrong? how can referred xml schema without them?


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -