java - Invalid content was found starting with element 'elementName'. No child element is expected at this point -


i'm working xml , i'm using xsd validate xml file. xsd , xml file long , can give part of them.

xsd file:

... <xs:complextype name="banktype">     <xs:choice>         <xs:element name="code" type="codetype" minoccurs="1" maxoccurs="1" />         <xs:element name="newcode" type="codetype" minoccurs="0" maxoccurs="1" />         <xs:element name="swiftbic" type="swifttype" minoccurs="0" maxoccurs="1" />         <xs:element name="name" type="nametype" minoccurs="0" maxoccurs="1" />         <xs:element name="coraccount" type="accounttype" minoccurs="0" maxoccurs="1" />         <xs:element name="subcoraccount" type="accounttype" minoccurs="0" maxoccurs="1" />         <xs:element name="taxnumber" type="taxnumbertype" minoccurs="0" maxoccurs="1" />         <xs:element name="address" type="addresstype" minoccurs="0" maxoccurs="1" />         <xs:element name="phonenumber" type="phonenotype" minoccurs="0" maxoccurs="unbounded" />         <xs:element name="faxnumber" type="faxnumbertype" minoccurs="0" maxoccurs="unbounded" />     </xs:choice> </xs:complextype>  <xs:complextype name="operationsforbanktype">     <xs:sequence>         <xs:element name="method" type="methodtype" minoccurs="1" maxoccurs="1" />         <xs:element name="bank" type="banktype" minoccurs="0" maxoccurs="unbounded" />     </xs:sequence> </xs:complextype> ... 

xml file:

... <operations>   <method>add</method>   <bank>     <code>111111</code>     <swiftbic>aaaaaaaa</swiftbic>     <name>asdfghjkl</name>     <coraccount>1111111111111111111111111111</coraccount>     <subcoraccount>1111111111111111111111111111</subcoraccount>     <taxnumber>1700792251</taxnumber>     <address>bakı şəhəri, nizami küçəsi, 70</address>     <phonenumber>+994125981107</phonenumber>     <faxnumber>+994125980307</faxnumber>   </bank>   ... 

and error reason: cvc-complex-type.2.4.d: invalid content found starting element 'swiftbic'. no child element expected @ point. how can solve it?

edit: used xs:sequence before order of tags might changeable that's why couldnot use it. elements can occur, can empty, can doesn't occur..

as can see in xsd elements expected.

choice indicator

the indicator specifies either 1 child element or can occur:

sequence indicator

the indicator specifies child elements must appear in specific order:

try this:-

<xs:complextype name="banktype">     <xs:sequence>         <xs:element name="code" type="codetype" minoccurs="1" maxoccurs="1" />         <xs:element name="newcode" type="codetype" minoccurs="0" maxoccurs="1" />         <xs:element name="swiftbic" type="swifttype" minoccurs="0" maxoccurs="1" />         <xs:element name="name" type="nametype" minoccurs="0" maxoccurs="1" />         <xs:element name="coraccount" type="accounttype" minoccurs="0" maxoccurs="1" />         <xs:element name="subcoraccount" type="accounttype" minoccurs="0" maxoccurs="1" />         <xs:element name="taxnumber" type="taxnumbertype" minoccurs="0" maxoccurs="1" />         <xs:element name="address" type="addresstype" minoccurs="0" maxoccurs="1" />         <xs:element name="phonenumber" type="phonenotype" minoccurs="0" maxoccurs="unbounded" />         <xs:element name="faxnumber" type="faxnumbertype" minoccurs="0" maxoccurs="unbounded" />     </xs:sequence> </xs:complextype> 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -