Friday

The element has invalid child element. List of possible elements expected: .

Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring'.

To fix this XSD problem:
Theory:

XSD gives 3 indicators: <xs:all>, <xs:sequence>, and <xs:choice>.

xs:all allows the specified child elements to appear (or not) in any order in the containing element... except they can only appear once.

xs:sequence requires the specified child elements to appear in the order they are given

and xs:choice requires that only one of the specified child elements appears, but it can appear any number of times.


so I just changed tag from <xs:sequence> to <xs:all> and it fixed problem.

orginal code

   
<xs:element name="Requirement" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="Duration" type="xs:int" minOccurs="0" />
<xs:element name="Occurring" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>


changed code

   
<xs:element name="Schedule" minOccurs="0">
<xs:complexType>
<xs:all>
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="Duration" type="xs:int" minOccurs="0" />
<xs:element name="Occurring" type="xs:int" minOccurs="0" />
</xs:all>
</xs:complexType>
</xs:element>

2 comments:

Anonymous said...

Thank you so much for sharing this. I have just started playing around with XSD/XSLT. and this error was kind of hacking my motivation level. Thanks again :-)

Anonymous said...

This is really Great articles. I have already wast my 5 hrs if I see your Article before that I could save it. any way thats for this. :)

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...