这是我在这个论坛上的第一篇文章。
我有一个代表 pnr(航班)预订列表的 xml。在这个里面它有一个单独的 pnrs 列表。现在,如果一个 pnr 有一个无效字段,在再次验证 xml 架构时,我们会遇到肥皂错误,并且验证似乎在第一个错误点处停止。
所以本质上,如果一个航班中有 100 个 pnr,如果一个 pnr 有一个无效字段,那么整个响应都会因为那个无效 pnr 而丢失。要求是如果 pnr 出现错误则拒绝它,并与其余有效 pnr 一起发送响应。
如何通过配置或以编程方式通过 spring xsd 验证来实现这一点。
<complexType name="DutBookings">
<sequence>
<element name="RecCount" type="long" minOccurs="1" maxOccurs="1"/>
<element name="DutBooking" type="tns:DutBooking" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<!-- -->
<complexType name="DutBooking">
<annotation>
<documentation>
This holds the booking record.
The frequent flyer details and airline customer value held at this level represents
the highest tier / value for all passengers associated with the booking.
</documentation>
</annotation>
<sequence>
<element name="BookingReference" type="tns:FlightBookingReference" minOccurs="0"/>
<element name="BookingDate" type="dateTime" minOccurs="0"/>
<element name="BookingStatus" type="tns:BookingStatus" minOccurs="0"/>
<element name="BookingType" type="tns:BookingType" minOccurs="0"/>
<element name="CreatingBookingOffice" type="tns:OfficeID" minOccurs="0"/>
<element name="POSCity" type="tns:CityCode" minOccurs="0"/>
<element name="POSCountry" type="tns:ISO_CountryCode" minOccurs="0"/>
<element name="NameCount" type="tns:Count" minOccurs="0">
<annotation>
<documentation>Number of real names on booking, includes infants</documentation>
</annotation>
</element>
<element name="ReservationCount" type="tns:Count" minOccurs="0">
<annotation>
<documentation>Count of passengers on booking, excludes infants</documentation>
</annotation>
</element>
<element name="MaxAirlineCustomerValue" type="int" minOccurs="0"/>
<element name="CabinCode" type="tns:CabinCode" minOccurs="0"/>
<element name="BookingClass" type="tns:SellingClass" minOccurs="0"/>
<element name="SplitCount" type="tns:Count" minOccurs="0">
<annotation>
<documentation>Number of names split from the booking</documentation>
</annotation>
</element>
<element name="SplitParentBookingReference" type="tns:FlightBookingReference" minOccurs="0"/>
<element name="StaffNumber" type="tns:StaffNumber" minOccurs="0"/>
<element name="StaffJoiningDate" type="date" minOccurs="0"/>
<element name="StaffTravelPriorityCode" type="tns:StaffTravelPriorityCode" minOccurs="0"/>
<element name="BookingPassenger" type="tns:BookingPassenger" minOccurs="0" maxOccurs="unbounded"/>
<element name="SuitabilityKeyword" type="tns:SuitabilityKeyword" minOccurs="0" maxOccurs="unbounded"/>
<element name="DutServiceLine" type="tns:DutServiceLine" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
所以你可以看到有 dutbookings 元素,里面有一个 dutbooking 列表。如果一个预订中有验证错误,我想继续其余的。
提前致谢。