coldfusion - Is there is a way to validate xml with xsd schema element with minoccour='1' -


i have xsd file

<?xml version="1.0"?> <xs:schema id="peoples" xmlns="" xmlns:xs="http://www.w3.org/2001/xmlschema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">   <xs:element name="peoples">     <xs:complextype>       <xs:sequence minoccurs="1" maxoccurs="unbounded">         <xs:element name="people">           <xs:complextype>             <xs:all>               <xs:element name="firstname" minoccurs="1" >                   <xs:simpletype>                     <xs:restriction base="xs:string">                       <xs:minlength value="1"/>                       <xs:maxlength value="50"/>                     </xs:restriction>                   </xs:simpletype>                      </xs:element>                 <xs:element name="lastname" minoccurs="1" >                   <xs:simpletype>                     <xs:restriction base="xs:string">                       <xs:minlength value="1"/>                       <xs:maxlength value="50"/>                     </xs:restriction>                   </xs:simpletype>                      </xs:element>                <xs:element name="midinitial" minoccurs="0">                   <xs:simpletype>                     <xs:restriction base="xs:string">                       <xs:maxlength value="50"/>                     </xs:restriction>                   </xs:simpletype>                 </xs:element>               <xs:element name="email" minoccurs="0" >                   <xs:simpletype>                     <xs:restriction base="xs:string">                       <xs:maxlength value="50"/>                     </xs:restriction>                   </xs:simpletype>                 </xs:element>              </xs:all>           </xs:complextype>         </xs:element>       </xs:sequence>     </xs:complextype>   </xs:element> </xs:schema> 

and xml file

<peoples xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="">     <people>         <firstname>james</firstname>     </people> </peoples> 

the xml validation gives :1:142: cvc-complex-type.2.4.b: content of element 'people' not complete. 1 of '{lastname, midinitial, email}' expected.

but in firstname , lastname requied field. there way validate xml required field alone

your problem not validator validating incorrectly. problem don't error messages. options try validator see if produces validation message case better, or used fact error messages don't tell wish did, , tell things wish didn't.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -