View Single Post
 
Old August 28th, 2006, 07:31 PM
cmiller66 cmiller66 is offline
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default making records optional in an XSD

I am building a schema that has the following format:

unique Row 1
Optional (repeating) Row 2
Optional (repeating) Row 3
Optional (repeating) Row 4
Optional (repeating) Row 5
Optional (repeating) Row 6

I need to setup my XSD so that if Rows 2, 3 and 5 have values and 4 doesn't, the XML file will only show the following:

<root>
   <Row1/>
   <Row2/>
   <Row3/>
   <Row5/>
   <Row6/>
</root>

I have set the minOccurs to 0 for Row 4 but when the the schema runs and the XML file gets rendered with no value for row 4 it looks like the following:

<root>
   <Row1>Value1</Row1>
   <Row2>Value2</Row2>
   <Row3>Value3</Row3>
   <Row4>Value5</Row4>
   <Row5>Value6</Row5>
</root>

Row 4 should be out of the of the XML and row 5 and 6 should have the correct values.

Does anyone have any ideas on how to solve this issue?

I can post the XSD if necessary. Thanks.