Getting Invalid Child Element, how to modify schema?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
How to modify schema of an element in order to avoid validation error like "Invalid Child Element" or "List of possible elements expected"? I tried putting a value string in CarModel element and also an empty "<CarModel></CarModel>",
still getting an error... For the "List of possible elements", when I removed the "maxOccurs" attribute this validation error disappears... I want it this element to have either single or multiple instances... Can anyone tells me how to correct the
schema definition and explain why I am getting these errors? Thanks.
Sample Schema definition:
<pre class="prettyprint <?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" elementFormDefault="qualified
<xs:element name="SOT
<xs:complexType>
<xs:sequence>
<xs:element name="TOT" type="xs:string" minOccurs="0" />
<xs:element name="ACC" type="xs:string" minOccurs="0" />
<xs:element name="PID" type="xs:string" minOccurs="0" />
<xs:element name="DOB" type="xs:string" minOccurs="0" />
<xs:element name="GENDER" type="xs:string" minOccurs="0" />
<xs:element name="DETAIL" type="xs:string" minOccurs="0" />
<xs:element name="PROVTYPE" type="xs:string" minOccurs="0" />
<xs:element name="MESSAGE" type="xs:string" minOccurs="0" msdata:AllowDBNull="true" />
<xs:element name="ANSWER" type="xs:string" minOccurs="0" />
<xs:element name="VERSION" type="xs:string" minOccurs="0" />
<xs:element name="NEWDRUG" minOccurs="0" maxOccurs="unbounded
<xs:complexType>
<xs:sequence>
<xs:element name="NEWDRUG_LINE" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true
<xs:complexType>
<xs:choice minOccurs="0" >
<xs:element ref="SOT" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>[/code]
<br/>
Xml Sample Data:

<pre class="prettyprint <SOT><TOT>HISTORY-REQ</TOT><ACC>MAINMSRI</ACC><PID>G424334</PID><DOB>19890820</DOB><GENDER>2</GENDER>
<DETAIL>RX</DETAIL><PROVTYPE>20</PROVTYPE>
<NEWDRUG>
<NEWDRUG_LINE>20120306 68115091200 30000 30 AB123456</NEWDRUG_LINE>
</NEWDRUG>
<MESSAGE></MESSAGE><ANSWER></ANSWER>
<VERSION>99</VERSION></SOT>[/code]
<br/>
Thanks,
Dennis
<br/>

View the full article
 
Back
Top