XML Schema won't validate -


ln 19 col 54 - s4s-elt-must-match.1: content of 'photo' must match (annotation?, (simpletype | complextype)?, (unique | key | keyref)*)). problem found starting at: attribute.

i cannot figure out. been @ 2 days now. :(

<catalog xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:nonamespaceschemalocation="catalog.xsd">     <photo cid="c1748" donatedby="john borelli">       <name metadata="tunis cooper property museum">tunis r. cooper property</name>       <description>       <![cdata[           photo taken john borelli's great-grandfather. believed have been taken around 1830.          david demarest purchased site of chair factory in 1663. site under ownership           of demarest family until 1758.  property listed in national , new jersey registers of historic places.       ]]>       </description>       <date>circa 1830</date>       <images>          <img src="1748a.jpg" />          <img src="1748b.jpg" />       </images>    </photo>     <photo cid="c1749" donatedby="john borelli">       <name metadata="tunis cooper property museum">tunis r. cooper property</name>       <description>       <![cdata[           more recent picture of property taken borelli family.  property listed in           national , new jersey registers of historic places.       ]]>       </description>       <date>circa 1950</date>       <images>          <img src="1749a.jpg" />       </images>    </photo>     <photo cid="c1411" donatedby="saint johns catholic church">       <name metadata="saint johns catholic church">saint johns church</name>       <description>       <![cdata[           more recent picture of property taken borelli family.  property listed in           national , new jersey registers of historic places.       ]]>       </description>             <date>1921</date>    </photo>      <photo cid="c2003" donatedby="linda choo">       <name metadata="bergenfield elementary school">bergenfield school</name>       <description>       <![cdata[           no. 5 public school, a.k.a. bergenfield school       ]]>       </description>       <date>circa 1920</date>       <images>          <img src="2003a.jpg" />          <img src="2003b.jpg" />       </images>    </photo>     <photo cid="c2078" donatedby="maria giodelli">       <name metadata="coopers pond water">coopers pond</name>       <description>       <![cdata[           favorite spot used go hang out kids.  picture shows brothers robert , michael.       ]]>       </description>       <date>may 4, 1941</date>       <images>          <img src="2078a.jpg" />       </images>    </photo>     <photo cid="c2079" donatedby="linda uffington">       <name metadata="watch timekeeping pocket railway">pocket watch</name>       <description>       <![cdata[           more recent picture of property taken borelli family.  property listed in           national , new jersey registers of historic places.       ]]>       </description>       <date>circa 1870</date>       <images>          <img src="2079a.jpg" />          <img src="2079b.jpg" />       </images>    </photo>     <photo cid="c3233">       <name metadata="hotel">bergenfield hotel</name>       <description>       <![cdata[           knollfield hotel known bergenfield hotel.  property listed in           national , new jersey registers of historic places.       ]]>       </description>       <date>circa 1920</date>    </photo>     <photo cid="c3433">       <name metadata="sweeney coal fuel">sweeney coal</name>       <description>       <![cdata[           sweeney fuel company located near new bridge road , railroad tracks.       ]]>       </description>       <date>1920</date>       <images>          <img src="3433a.jpg" />          <img src="3433b.jpg" />          <img src="3433c.jpg" />       </images>    </photo>  </catalog> 

xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema">   <xs:element name="catalog">      <xs:complextype>         <xs:sequence>            <xs:element name="photo" minoccurs="1" maxoccurs="unbounded">            <xs:attribute name="cid" type="cidtype" />            <xs:attribute name="donatedby" type="xs:string" use="optional" />                           <xs:complextype>                  <xs:sequence>                     <xs:element name="name">                        <xs:complextype>                           <xs:simplecontent>                              <xs:extension base="xs:string">                                 <xs:attribute name="metadata" type="xs:string" />                              </xs:extension>                           </xs:simplecontent>                        </xs:complextype>                     </xs:element>                     <xs:element name="description" type="xs:string" />                     <xs:element name="date" type="xs:string" />                     <xs:element name="images" minoccurs="0">                        <xs:complextype>                           <xs:sequence>                              <xs:element name="img">                                 <xs:complextype>                                   <xs:simplecontent>                                     <xs:extension base="xs:string">                                       <xs:attribute name="src" type="srctype" />                                     </xs:extension>                                   </xs:simplecontent>                                 </xs:complextype>                              </xs:element>                           </xs:sequence>                        </xs:complextype>                     </xs:element>                  </xs:sequence>               </xs:complextype>            </xs:element>         </xs:sequence>  <!-- closes catalog sequence -->      </xs:complextype> <!-- closes catalog complex type -->   </xs:element> <!-- closes catalog element -->   <xs:simpletype name="cidtype">     <xs:restriction base="xs:id">       <xs:pattern value="c\d{4}" />     </xs:restriction>   </xs:simpletype>  <xs:simpletype name="srctype">   <xs:restriction base="xs:string">     <xs:pattern value="[a-za-z0-9]+.jpg"/>   </xs:restriction> </xs:simpletype>  </xs:schema> 

in schema, <xs:attribute.../> declarations go inside <xs:complextype>...</xs:complextype> declaration , must come @ end, after <xs:sequence>.

once error fixed have problem in xsd @ definition

<xs:element name="img">     <xs:complextype>         <xs:simplecontent>             <xs:extension base="xs:string">                 <xs:attribute name="src" type="srctype" />             </xs:extension>         </xs:simplecontent>     </xs:complextype> </xs:element> 

where missing maxoccurs="unbounded" (or value greater 1, default) on specification of img element (assuming xml valid multiple img elements inside images, since plural guess case).


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -