In my XSD I have:
<xs:complexType name="scheduleLocation">
<xs:sequence>
<xs:element name="arrivalTime" type="hhmmss" default="00:00:00" minOccurs="0"/>
<xs:element name="departureTime" type="hhmmss" default="00:00:00" minOccurs="0"/>
<xs:element name="passingTime" type="xs:boolean" default="false" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Meaning that the following XML extract is valid:
<scheduleLocation>
<arrivalTime>07:33:00</arrivalTime>
<departureTime>07:34:00</departureTime>
</scheduleLocation>
(ie no passing time node)
Using the D6 XML Data Binding Wizard I get:
function TXMLScheduleLocation.Get_PassingTime: Boolean;
begin
Result := ChildNodes['passingTime'].NodeValue;
end;
Of course, if I try to get the passing time value then it crashes where passingTime is not specified in the XML. Is there any way around this - some trick with the wizard? Also, I think the default value is ignored. Am I going to have to hand edit the results?
Incidentally xsd.exe generates xxxSpecified fields which would have helped here.