XML Schema generation with optional elements

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I need to generate a XSD from XML DataFile. My Data looks like<br/>
<DOCUMENTS><br/>
<DOCUMENT><br/>
<T1>TEST1</T1><br/>
<T2>TEST2</T2><br/>
<T3>TEST3</T3><br/>
<T4>TEST4</T4><br/>
<T5>TEST5</T5><br/>
</DOCUMENT><br/>
</DOCUMENTS>
I am trying to generate a XSD where I dont want to specify about the elements other than T2 and T4.I need only to verify if T2 and T4 exists and the schema validation should fail if any of them does not exist. Because the data file may change tomorrow and
I can add a new element <T6></T6> and I dont want to update the XSD. And also the elements can occur in any order. The elements T2 and T4 should occur only once and they are mandatory.
I am trying to use <xs:any> attribute, but I am not able to use it along with <xs:all>..
Any help is apprieciated

View the full article
 
Back
Top