git.iko.soy/typeable/xsd-parser
on master help sign in
Works with simple.xsd, fails with retrieve_seat_map
commit3f7e8866fdb912b317f9526b0b3fed268b1a4a33 authorDenis Redozubov <denis.redozubov@gmail.com> dateFri 4 Oct 2019, 16:10 (7 years ago) parent5f3579e
4 files changed+651−31
src/Text/XSD/Internal.hs+7−8 src/Text/XSD/Parser.hs+26−23 test/fixtures/retrieve_seat_map.xml+600 test/fixtures/simple.xsd+18
src/Text/XSD/Internal.hs+7−8
@@ -13,19 +13,19 @@ import Data.Map as M
1313data Datatype
1414 = ComplexType (Maybe Text) ModelGroupSchema [Element]
1515 | SimpleType SimpleType
16− deriving (Show)
16+ deriving (Show, Eq)
1717
1818data DatatypeRef
1919 = InlineComplex Datatype
2020 | DatatypeRef Text
21− deriving (Show)
21+ deriving (Show, Eq)
2222
2323-- | Based on https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#Model_Group_details
2424data ModelGroupSchema
2525 = CTSequence
2626 | CTChoice
2727 | CTAll
28− deriving (Show)
28+ deriving (Show, Eq)
2929
3030-- | ENTITIES, IDREFS and NMTOKENS are not supported right now.
3131data SimpleType
@@ -50,7 +50,7 @@ data SimpleType
5050 | STTime
5151 | STUnion [SimpleType] -- special - xs:union
5252 | STList [SimpleType] -- special - xs:list
53− deriving (Show)
53+ deriving (Show, Eq)
5454
5555data StringType
5656 = StrNormalizedString
@@ -62,7 +62,7 @@ data StringType
6262 | StrID
6363 | StrIDREF
6464 | StrNMTOKEN
65− deriving (Show)
65+ deriving (Show, Eq)
6666
6767data DurationType = DayTimeDuration | YearMonthDuration deriving (Show, Eq)
6868
@@ -99,9 +99,8 @@ type QName = (Maybe Namespace, LocalName)
9999data Element = Element
100100 { name :: QName
101101 , xtype :: DatatypeRef
102− -- , elements :: [Element]
103− } deriving (Show)
102+ } deriving (Show, Eq)
104103
105104-- | Embodies an XSD document
106105newtype XSD = XSD { unXSD :: [Element] }
107− deriving (Show)
106+ deriving (Show, Eq)
src/Text/XSD/Parser.hs+26−23
@@ -9,7 +9,7 @@ import Data.ByteString.Lazy
99import Data.Foldable
1010import Data.Map as M
1111import Data.Maybe
12−import Data.Text
12+import Data.Text as T
1313import Prelude as P
1414import Text.XML as XML
1515import Text.XML.Cursor as XML
@@ -23,7 +23,7 @@ instance Exception XSDException
2323
2424type XSDMonad a = WriterT (M.Map Text Datatype) (Either SomeException) a
2525
26−parseXSD :: ParseSettings -> ByteString -> Either SomeException XSD.Element
26+parseXSD :: ParseSettings -> ByteString -> Either SomeException XSD
2727parseXSD ps bs = parseLBS ps bs >>= toXsd
2828
2929data Expectation
@@ -72,8 +72,8 @@ attrThrowXsd name elNode = maybeThrowXsd (M.lookup name $ elementAttributes elNo
7272-- | Tells the writer about named complex types and returns a list of elements.
7373toElemsAndDatatypes :: XML.Cursor -> XSDMonad [XSD.Element]
7474toElemsAndDatatypes cursor = do
75− elems <- traverse toElem (cursor $// laxElement "element")
76− datatypes <- traverse toDatatype (cursor $// laxElement "complexType")
75+ elems <- traverse toElem (cursor $/ laxElement "element")
76+ datatypes <- traverse toDatatype (cursor $/ laxElement "complexType")
7777 for_ datatypes $ \case
7878 datatype@(ComplexType (Just name) _ _) -> tell (M.singleton name datatype)
7979 datatype@(ComplexType Nothing _ _) ->
@@ -97,24 +97,24 @@ toElem cursor = do
9797 NodeElement el -> case nameLocalName (elementName el) of
9898 "element" -> do
9999 let
100− attrs = elementAttributes el
100+ attrs = elementAttributes el
101101 mAttrType = M.lookup "type" attrs
102− ns = nameNamespace $ elementName el
102+ ns = nameNamespace $ elementName el
103103 name <- attrThrowXsd "name" el
104104 $ "Expected attribute 'name' for element: " <> show (node cursor)
105105 datatypeRef <- case mAttrType of
106106 Just dtn -> pure $ DatatypeRef dtn
107107 Nothing -> do
108− onlyChildCursor <- maybeThrowXsd
109− (safeHead $ cursor $// laxElement "simpleType")
110− $ "Only one type child element expected for element: " <> show name
111− InlineComplex <$> toDatatype onlyChildCursor
108+ case safeHead (cursor $// anyElement) of
109+ Just c -> InlineComplex <$> toDatatype c
110+ Nothing ->
111+ throwXsd $ "[toElem] unexpected children of " <> T.unpack name
112112 pure $ XSD.Element
113113 { name = (ns, name)
114114 , xtype = datatypeRef }
115− e -> throwXsd $ "xsd node not supported: " <> show e
115+ e -> throwXsd $ "[toElem] xsd node not supported: " <> show e
116116 e ->
117− throwXsd $ "element expected, got: " <> show e
117+ throwXsd $ "[toElem] element expected, got: " <> show e
118118
119119-- | Returns 'Just element' if encounters an element,
120120toDatatype :: Cursor -> XSDMonad Datatype
@@ -124,9 +124,9 @@ toDatatype cursor = do
124124 "simpleType" -> do
125125 error "implement simpleType"
126126 "complexType" -> do
127− let sequenceAxis = laxElement "complexType" &// laxElement "sequence"
128− let choiceAxis = laxElement "complexType" &// laxElement "choice"
129− let allAxis = laxElement "complexType" &// laxElement "all"
127+ let sequenceAxis = laxElement "sequence"
128+ let choiceAxis = laxElement "choice"
129+ let allAxis = laxElement "all"
130130 if P.null (cursor $// sequenceAxis)
131131 then if P.null (cursor $// choiceAxis)
132132 then if P.null (cursor $// allAxis)
@@ -136,22 +136,25 @@ toDatatype cursor = do
136136 childCursor <- maybeThrowXsd (safeHead $ cursor $// allAxis)
137137 $ "More than one xs:all tag in: "
138138 <> show (cursor $// laxElement "complexType")
139− ComplexType Nothing CTAll <$> toElemsAndDatatypes childCursor
139+ let name = safeHead $ cursor $| attribute "name"
140+ ComplexType name CTAll <$> toElemsAndDatatypes childCursor
140141 else do
141142 childCursor <- maybeThrowXsd (safeHead $ cursor $// choiceAxis)
142143 $ "More than one xs:choice tag in: "
143144 <> show (cursor $// laxElement "complexType")
144− ComplexType Nothing CTChoice <$> toElemsAndDatatypes childCursor
145+ let name = safeHead $ cursor $| attribute "name"
146+ ComplexType name CTChoice <$> toElemsAndDatatypes childCursor
145147 else do
146148 childCursor <- maybeThrowXsd (safeHead $ cursor $// sequenceAxis)
147149 $ "More than one xs:sequence tag in: "
148150 <> show (cursor $// laxElement "complexType")
149− ComplexType Nothing CTSequence <$> toElemsAndDatatypes childCursor
150− e -> throwXsd $ "xsd node not supported: " <> show e
151+ let name = safeHead $ cursor $| attribute "name"
152+ ComplexType name CTSequence <$> toElemsAndDatatypes childCursor
153+ e -> throwXsd $ "[toDatatype] xsd node not supported: " <> show e
151154 e ->
152− throwXsd $ "element expected, got: " <> show e
155+ throwXsd $ "[toDatatype] element expected, got: " <> show e
153156
154−toXsd :: Document -> Either SomeException XSD.Element
157+toXsd :: Document -> Either SomeException XSD
155158toXsd doc = do
156− (dt, el) <- runWriterT $ toSchema (fromDocument doc)
157− error "implement me"
159+ (el, dt) <- runWriterT $ toSchema (fromDocument doc)
160+ pure el
test/fixtures/retrieve_seat_map.xmlnew file+600
@@ -0,0 +1,600 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.amadeus.com/SMPREQ_13_1_IA" xmlns="http://xml.amadeus.com/SMPREQ_13_1_IA" elementFormDefault="qualified">
3+ <xs:element name="Air_RetrieveSeatMap">
4+ <xs:annotation>
5+ <xs:documentation xml:lang="en">To request seat map information for a specific flight and date.</xs:documentation>
6+ </xs:annotation>
7+ <xs:complexType>
8+ <xs:sequence>
9+ <xs:element name="travelProductIdent" type="TravelProductInformationTypeI">
10+ <xs:annotation>
11+ <xs:documentation xml:lang="en">Travel Product Identification</xs:documentation>
12+ </xs:annotation>
13+ </xs:element>
14+ <xs:element name="seatRequestParameters" minOccurs="0" type="SeatRequestParametersTypeI">
15+ <xs:annotation>
16+ <xs:documentation xml:lang="en">Seat Request Parameters</xs:documentation>
17+ </xs:annotation>
18+ </xs:element>
19+ <xs:element name="productInformation" minOccurs="0" type="RelatedProductInformationTypeI" />
20+ <xs:element name="frequentTravelerInfo" minOccurs="0" type="FrequentTravellerInformationTypeI">
21+ <xs:annotation>
22+ <xs:documentation xml:lang="en">Frequent Traveler Information</xs:documentation>
23+ </xs:annotation>
24+ </xs:element>
25+ <xs:element name="resControlInfo" minOccurs="0" type="ReservationControlInformationTypeI">
26+ <xs:annotation>
27+ <xs:documentation xml:lang="en">Record locator details</xs:documentation>
28+ </xs:annotation>
29+ </xs:element>
30+ <xs:element name="equipmentInformation" minOccurs="0" type="EquipmentInfoTypeI" />
31+ <xs:element name="additionalInfo" minOccurs="0" type="AdditionalBusinessSourceInformationTypeI">
32+ <xs:annotation>
33+ <xs:documentation xml:lang="en">Point of Sell override</xs:documentation>
34+ </xs:annotation>
35+ </xs:element>
36+ <xs:element name="conversionRate" minOccurs="0" type="ConversionRateTypeI">
37+ <xs:annotation>
38+ <xs:documentation xml:lang="en">To return price in another currency</xs:documentation>
39+ </xs:annotation>
40+ </xs:element>
41+ <xs:element name="traveler" minOccurs="0" maxOccurs="99">
42+ <xs:annotation>
43+ <xs:documentation xml:lang="en">Traveler detail group</xs:documentation>
44+ </xs:annotation>
45+ <xs:complexType>
46+ <xs:sequence>
47+ <xs:element name="travelerInformation" type="TravellerInformationTypeI" />
48+ <xs:element name="frequentTravelerDetails" minOccurs="0" maxOccurs="99" type="FrequentTravellerInformationTypeI" />
49+ <xs:element name="fareInfo" minOccurs="0" type="FareInformationTypeI">
50+ <xs:annotation>
51+ <xs:documentation xml:lang="en">PTC override and Ticket Designator</xs:documentation>
52+ </xs:annotation>
53+ </xs:element>
54+ <xs:element name="dateAndTimeInfo" minOccurs="0" type="DateAndTimeInformationTypeI">
55+ <xs:annotation>
56+ <xs:documentation xml:lang="en">Date of Birth</xs:documentation>
57+ </xs:annotation>
58+ </xs:element>
59+ <xs:element name="ticketDetails" minOccurs="0" type="TicketNumberTypeI">
60+ <xs:annotation>
61+ <xs:documentation xml:lang="en">eTicket number for pricing override</xs:documentation>
62+ </xs:annotation>
63+ </xs:element>
64+ <xs:element name="fareQualifierDetails" minOccurs="0" type="FareQualifierDetailsTypeI">
65+ <xs:annotation>
66+ <xs:documentation xml:lang="en">Fare Basis</xs:documentation>
67+ </xs:annotation>
68+ </xs:element>
69+ </xs:sequence>
70+ </xs:complexType>
71+ </xs:element>
72+ </xs:sequence>
73+ </xs:complexType>
74+ </xs:element>
75+ <xs:complexType name="AdditionalBusinessSourceInformationTypeI">
76+ <xs:annotation>
77+ <xs:documentation xml:lang="en">To specify additional originator and source information.</xs:documentation>
78+ </xs:annotation>
79+ <xs:sequence>
80+ <xs:element name="sourceType" type="SourceTypeDetailsTypeI" />
81+ <xs:element name="originatorDetails" minOccurs="0" type="OriginatorIdentificationDetailsTypeI" />
82+ <xs:element name="locationDetails" minOccurs="0" type="LocationTypeI" />
83+ <xs:element name="countryCode" minOccurs="0" type="AlphaNumericString_Length1To3" />
84+ <xs:element name="systemCode" minOccurs="0" type="AlphaNumericString_Length1To35" />
85+ </xs:sequence>
86+ </xs:complexType>
87+ <xs:complexType name="AdditionalEquipmentInformationTypeI">
88+ <xs:annotation>
89+ <xs:documentation xml:lang="en">To identify equipment configuration, registration number, and cabin facilities.</xs:documentation>
90+ </xs:annotation>
91+ <xs:sequence>
92+ <xs:element name="fittedConfigurationCode" minOccurs="0" type="AlphaNumericString_Length1To12" />
93+ <xs:element name="defaultConfigurationCode" minOccurs="0" type="AlphaNumericString_Length1To12" />
94+ <xs:element name="airlineDetails" minOccurs="0" type="AlphaNumericString_Length1To35" />
95+ <xs:element name="code" minOccurs="0" type="AlphaNumericString_Length1To17" />
96+ <xs:element name="characteristic" minOccurs="0" maxOccurs="2" type="AlphaNumericString_Length1To3" />
97+ </xs:sequence>
98+ </xs:complexType>
99+ <xs:complexType name="AdditionalFareQualifierDetailsTypeI">
100+ <xs:annotation>
101+ <xs:documentation xml:lang="en">To specify the fare basis and ticket designator codes.</xs:documentation>
102+ </xs:annotation>
103+ <xs:sequence>
104+ <xs:element name="rateClass" minOccurs="0" type="AlphaNumericString_Length1To35" />
105+ <xs:element name="commodityCategory" minOccurs="0" type="AlphaNumericString_Length1To18" />
106+ </xs:sequence>
107+ </xs:complexType>
108+ <xs:complexType name="CompanyIdentificationTypeI">
109+ <xs:annotation>
110+ <xs:documentation xml:lang="en">Code or name to identify a company and any associated companies.</xs:documentation>
111+ </xs:annotation>
112+ <xs:sequence>
113+ <xs:element name="marketingCompany" minOccurs="0" type="AlphaNumericString_Length1To35" />
114+ <xs:element name="operatingCompany" minOccurs="0" type="AlphaNumericString_Length1To35" />
115+ </xs:sequence>
116+ </xs:complexType>
117+ <xs:complexType name="ConfigurationDetailsTypeI">
118+ <xs:annotation>
119+ <xs:documentation xml:lang="en">To identify the number of seats for a specific class of service.</xs:documentation>
120+ </xs:annotation>
121+ <xs:sequence>
122+ <xs:element name="classDesignator" type="AlphaString_Length1To1" />
123+ <xs:element name="numberOfSeats" minOccurs="0" type="NumericInteger_Length1To3" />
124+ <xs:element name="characteristic" minOccurs="0" maxOccurs="26" type="AlphaNumericString_Length1To17" />
125+ </xs:sequence>
126+ </xs:complexType>
127+ <xs:complexType name="ConversionRateDetailsTypeI">
128+ <xs:annotation>
129+ <xs:documentation xml:lang="en">To specify the conversion rate and the monetary amount.</xs:documentation>
130+ </xs:annotation>
131+ <xs:sequence>
132+ <xs:element name="conversionType" minOccurs="0" type="AlphaNumericString_Length1To3" />
133+ <xs:element name="currency" minOccurs="0" type="AlphaNumericString_Length1To3" />
134+ </xs:sequence>
135+ </xs:complexType>
136+ <xs:complexType name="ConversionRateTypeI">
137+ <xs:annotation>
138+ <xs:documentation xml:lang="en">To specify details of a conversion rate related to an amount.</xs:documentation>
139+ </xs:annotation>
140+ <xs:sequence>
141+ <xs:element name="conversionRateDetails" type="ConversionRateDetailsTypeI" />
142+ </xs:sequence>
143+ </xs:complexType>
144+ <xs:complexType name="DateAndTimeDetailsTypeI">
145+ <xs:annotation>
146+ <xs:documentation xml:lang="en">To provide date and time details relative to flight movements.</xs:documentation>
147+ </xs:annotation>
148+ <xs:sequence>
149+ <xs:element name="qualifier" minOccurs="0" type="AlphaNumericString_Length1To3" />
150+ <xs:element name="date" minOccurs="0" type="AlphaNumericString_Length1To35" />
151+ </xs:sequence>
152+ </xs:complexType>
153+ <xs:complexType name="DateAndTimeInformationTypeI">
154+ <xs:annotation>
155+ <xs:documentation xml:lang="en">To provide date and time details relative to flight movements.</xs:documentation>
156+ </xs:annotation>
157+ <xs:sequence>
158+ <xs:element name="dateAndTimeDetails" minOccurs="0" maxOccurs="99" type="DateAndTimeDetailsTypeI" />
159+ </xs:sequence>
160+ </xs:complexType>
161+ <xs:complexType name="EquipmentInfoTypeI">
162+ <xs:annotation>
163+ <xs:documentation xml:lang="en">To specify configuration details of an aircraft.</xs:documentation>
164+ </xs:annotation>
165+ <xs:sequence>
166+ <xs:element name="cabinClassDetails" minOccurs="0" maxOccurs="5" type="ConfigurationDetailsTypeI" />
167+ <xs:element name="iataAircraftTypeCode" minOccurs="0" type="AlphaNumericString_Length1To8" />
168+ <xs:element name="configVersionDetails" minOccurs="0" type="AdditionalEquipmentInformationTypeI" />
169+ <xs:element name="configVersionDescription" minOccurs="0" type="AlphaNumericString_Length1To70" />
170+ </xs:sequence>
171+ </xs:complexType>
172+ <xs:complexType name="FareInformationTypeI">
173+ <xs:annotation>
174+ <xs:documentation xml:lang="en">To specify fare details.</xs:documentation>
175+ </xs:annotation>
176+ <xs:sequence>
177+ <xs:element name="valueQualifier" minOccurs="0" type="AlphaNumericString_Length1To3" />
178+ <xs:element name="rateCategory" minOccurs="0" maxOccurs="9" type="AlphaNumericString_Length1To35" />
179+ </xs:sequence>
180+ </xs:complexType>
181+ <xs:complexType name="FareQualifierDetailsTypeI">
182+ <xs:annotation>
183+ <xs:documentation xml:lang="en">To specify the details which qualify a fare</xs:documentation>
184+ </xs:annotation>
185+ <xs:sequence>
186+ <xs:element name="additionalFareDetails" minOccurs="0" type="AdditionalFareQualifierDetailsTypeI" />
187+ </xs:sequence>
188+ </xs:complexType>
189+ <xs:complexType name="FrequentTravellerIdentificationTypeI">
190+ <xs:annotation>
191+ <xs:documentation xml:lang="en">Identification of the frequent traveller number by company code with the capability to reference a specific traveller.</xs:documentation>
192+ </xs:annotation>
193+ <xs:sequence>
194+ <xs:element name="carrier" type="AlphaNumericString_Length1To35" />
195+ <xs:element name="number" type="AlphaNumericString_Length1To25" />
196+ <xs:element name="customerReference" minOccurs="0" type="AlphaNumericString_Length1To10" />
197+ <xs:element name="tierLevel" minOccurs="0" type="AlphaNumericString_Length1To35" />
198+ <xs:element name="priorityCode" minOccurs="0" type="AlphaNumericString_Length1To12" />
199+ <xs:element name="customerValue" minOccurs="0" type="NumericInteger_Length1To4" />
200+ <xs:element name="type" minOccurs="0" type="AlphaNumericString_Length1To3">
201+ <xs:annotation>
202+ <xs:documentation xml:lang="en">To specify the product/account number qualifier. (e.g. 2=Corporate Frequent Flyer).</xs:documentation>
203+ </xs:annotation>
204+ </xs:element>
205+ </xs:sequence>
206+ </xs:complexType>
207+ <xs:complexType name="FrequentTravellerInformationTypeI">
208+ <xs:annotation>
209+ <xs:documentation xml:lang="en">To specify frequent traveler information.</xs:documentation>
210+ </xs:annotation>
211+ <xs:sequence>
212+ <xs:element name="frequentTravellerDetails" type="FrequentTravellerIdentificationTypeI" />
213+ <xs:element name="otherFrequentTravellerDetails" minOccurs="0" maxOccurs="98" type="FrequentTravellerIdentificationTypeI" />
214+ </xs:sequence>
215+ </xs:complexType>
216+ <xs:complexType name="GenericDetailsTypeI">
217+ <xs:annotation>
218+ <xs:documentation xml:lang="en">To identify the type of seat requested.</xs:documentation>
219+ </xs:annotation>
220+ <xs:sequence>
221+ <xs:element name="cabinClassDesignator" minOccurs="0" type="AlphaString_Length1To1" />
222+ <xs:element name="noSmokingIndicator" minOccurs="0" type="AlphaString_Length1To1" />
223+ <xs:element name="cabinClass" minOccurs="0" type="NumericInteger_Length1To1" />
224+ <xs:element name="compartmentDesignator" minOccurs="0" type="AlphaString_Length1To1" />
225+ <xs:element name="seatCharacteristic" minOccurs="0" maxOccurs="5" type="AMA_EDICodesetType_Length1to2" />
226+ </xs:sequence>
227+ </xs:complexType>
228+ <xs:complexType name="LocationTypeI">
229+ <xs:annotation>
230+ <xs:documentation xml:lang="en">To identify a location by code or name.</xs:documentation>
231+ </xs:annotation>
232+ <xs:sequence>
233+ <xs:element name="trueLocationId" minOccurs="0" type="AlphaNumericString_Length1To25" />
234+ <xs:element name="trueLocation" minOccurs="0" type="AlphaNumericString_Length1To17" />
235+ </xs:sequence>
236+ </xs:complexType>
237+ <xs:complexType name="OriginatorIdentificationDetailsTypeI">
238+ <xs:annotation>
239+ <xs:documentation xml:lang="en">To identify the originator of the travel request.</xs:documentation>
240+ </xs:annotation>
241+ <xs:sequence>
242+ <xs:element name="originatorId" minOccurs="0" type="NumericInteger_Length1To9">
243+ <xs:annotation>
244+ <xs:documentation xml:lang="en">is alpanum since the sine of an agent might contain his initials and duty code</xs:documentation>
245+ </xs:annotation>
246+ </xs:element>
247+ <xs:element name="inHouseIdentification1" minOccurs="0" type="AlphaNumericString_Length1To9" />
248+ <xs:element name="inHouseIdentification2" minOccurs="0" type="AlphaNumericString_Length1To9" />
249+ <xs:element name="inHouseIdentification3" minOccurs="0" type="AlphaNumericString_Length1To9" />
250+ </xs:sequence>
251+ </xs:complexType>
252+ <xs:complexType name="ProductDateTimeTypeI">
253+ <xs:annotation>
254+ <xs:documentation xml:lang="en">To specify the dates and times associated with a product.</xs:documentation>
255+ </xs:annotation>
256+ <xs:sequence>
257+ <xs:element name="departureDate" minOccurs="0" type="AlphaNumericString_Length1To35" />
258+ <xs:element name="departureTime" minOccurs="0" type="Time24_HHMM" />
259+ <xs:element name="arrivalDate" minOccurs="0" type="AlphaNumericString_Length1To35" />
260+ <xs:element name="arrivalTime" minOccurs="0" type="Time24_HHMM" />
261+ <xs:element name="dateVariation" minOccurs="0" type="NumericInteger_Length1To1" />
262+ </xs:sequence>
263+ </xs:complexType>
264+ <xs:complexType name="ProductIdentificationDetailsTypeI">
265+ <xs:annotation>
266+ <xs:documentation xml:lang="en">Code, number or name to identify a specific product or service.</xs:documentation>
267+ </xs:annotation>
268+ <xs:sequence>
269+ <xs:element name="flightNumber" type="AlphaNumericString_Length1To35" />
270+ <xs:element name="bookingClass" minOccurs="0" type="AlphaNumericString_Length1To17" />
271+ <xs:element name="operationalSuffix" minOccurs="0" type="AlphaNumericString_Length1To3" />
272+ <xs:element name="modifier" minOccurs="0" maxOccurs="3" type="AlphaNumericString_Length1To7" />
273+ </xs:sequence>
274+ </xs:complexType>
275+ <xs:complexType name="ProductTypeDetailsTypeI">
276+ <xs:annotation>
277+ <xs:documentation xml:lang="en">To specify additional characteristics of a product or service.</xs:documentation>
278+ </xs:annotation>
279+ <xs:sequence>
280+ <xs:element name="flightIndicator" maxOccurs="9" type="AlphaNumericString_Length1To6" />
281+ </xs:sequence>
282+ </xs:complexType>
283+ <xs:complexType name="RangeOfRowsDetailsTypeI">
284+ <xs:annotation>
285+ <xs:documentation xml:lang="en">To specify row information for a means of transport.</xs:documentation>
286+ </xs:annotation>
287+ <xs:sequence>
288+ <xs:element name="seatRowNumber" type="NumericInteger_Length1To3" />
289+ <xs:element name="numberOfRows" minOccurs="0" type="NumericInteger_Length1To3" />
290+ <xs:element name="seatColumn" minOccurs="0" maxOccurs="20" type="AlphaNumericString_Length1To1" />
291+ </xs:sequence>
292+ </xs:complexType>
293+ <xs:complexType name="RelatedProductInformationTypeI">
294+ <xs:annotation>
295+ <xs:documentation xml:lang="en">To indicate quantity and action required in relation to a product.</xs:documentation>
296+ </xs:annotation>
297+ <xs:sequence>
298+ <xs:element name="quantity" minOccurs="0" type="NumericInteger_Length1To15" />
299+ <xs:element name="statusCode" minOccurs="0" maxOccurs="10" type="AlphaNumericString_Length1To3" />
300+ </xs:sequence>
301+ </xs:complexType>
302+ <xs:complexType name="ReservationControlInformationDetailsTypeI">
303+ <xs:annotation>
304+ <xs:documentation xml:lang="en">To specify the information required to identify a reservation.</xs:documentation>
305+ </xs:annotation>
306+ <xs:sequence>
307+ <xs:element name="companyId" minOccurs="0" type="AlphaNumericString_Length1To35" />
308+ <xs:element name="controlNumber" minOccurs="0" type="AlphaNumericString_Length1To20" />
309+ <xs:element name="controlType" minOccurs="0" type="AlphaNumericString_Length1To1" />
310+ <xs:element name="date" minOccurs="0" type="AlphaNumericString_Length1To35" />
311+ <xs:element name="time" minOccurs="0" type="NumericInteger_Length1To9" />
312+ </xs:sequence>
313+ </xs:complexType>
314+ <xs:complexType name="ReservationControlInformationTypeI">
315+ <xs:annotation>
316+ <xs:documentation xml:lang="en">To specify a reference to a reservation.</xs:documentation>
317+ </xs:annotation>
318+ <xs:sequence>
319+ <xs:element name="reservation" minOccurs="0" maxOccurs="9" type="ReservationControlInformationDetailsTypeI" />
320+ </xs:sequence>
321+ </xs:complexType>
322+ <xs:complexType name="SeatRequestParametersTypeI">
323+ <xs:annotation>
324+ <xs:documentation xml:lang="en">To specify the selection criteria for a seat map request.</xs:documentation>
325+ </xs:annotation>
326+ <xs:sequence>
327+ <xs:element name="genericDetails" minOccurs="0" type="GenericDetailsTypeI" />
328+ <xs:element name="rangeOfRowsDetails" minOccurs="0" type="RangeOfRowsDetailsTypeI" />
329+ <xs:element name="processingIndicator" minOccurs="0" type="AlphaNumericString_Length1To3" />
330+ <xs:element name="referenceNumber" minOccurs="0" type="AlphaNumericString_Length1To35" />
331+ <xs:element name="description" minOccurs="0" type="AlphaNumericString_Length1To70" />
332+ </xs:sequence>
333+ </xs:complexType>
334+ <xs:complexType name="SourceTypeDetailsTypeI">
335+ <xs:annotation>
336+ <xs:documentation xml:lang="en">To identify the type of source.</xs:documentation>
337+ </xs:annotation>
338+ <xs:sequence>
339+ <xs:element name="sourceQualifier1" type="AlphaNumericString_Length1To3" />
340+ <xs:element name="sourceQualifier2" minOccurs="0" type="AlphaNumericString_Length1To3" />
341+ </xs:sequence>
342+ </xs:complexType>
343+ <xs:complexType name="TicketNumberDetailsTypeI">
344+ <xs:annotation>
345+ <xs:documentation xml:lang="en">To specify a ticket number, type of ticket, and related information.</xs:documentation>
346+ </xs:annotation>
347+ <xs:sequence>
348+ <xs:element name="number" minOccurs="0" type="AlphaNumericString_Length1To35" />
349+ </xs:sequence>
350+ </xs:complexType>
351+ <xs:complexType name="TicketNumberTypeI">
352+ <xs:annotation>
353+ <xs:documentation xml:lang="en">To convey information related to a specific ticket.</xs:documentation>
354+ </xs:annotation>
355+ <xs:sequence>
356+ <xs:element name="documentDetails" type="TicketNumberDetailsTypeI" />
357+ </xs:sequence>
358+ </xs:complexType>
359+ <xs:complexType name="TravelProductInformationTypeI">
360+ <xs:annotation>
361+ <xs:documentation xml:lang="en">To specify details related to a product.</xs:documentation>
362+ </xs:annotation>
363+ <xs:sequence>
364+ <xs:element name="flightDate" minOccurs="0" type="ProductDateTimeTypeI" />
365+ <xs:element name="boardPointDetails" minOccurs="0" type="LocationTypeI" />
366+ <xs:element name="offpointDetails" minOccurs="0" type="LocationTypeI" />
367+ <xs:element name="companyDetails" minOccurs="0" type="CompanyIdentificationTypeI" />
368+ <xs:element name="flightIdentification" minOccurs="0" type="ProductIdentificationDetailsTypeI" />
369+ <xs:element name="flightTypeDetails" minOccurs="0" type="ProductTypeDetailsTypeI" />
370+ </xs:sequence>
371+ </xs:complexType>
372+ <xs:complexType name="TravellerDetailsTypeI">
373+ <xs:annotation>
374+ <xs:documentation xml:lang="en">To identify the given/first name and the title of a traveller and the traveller type.</xs:documentation>
375+ </xs:annotation>
376+ <xs:sequence>
377+ <xs:element name="givenName" minOccurs="0" type="AlphaNumericString_Length1To70" />
378+ <xs:element name="type" minOccurs="0" type="AlphaNumericString_Length1To3" />
379+ <xs:element name="uniqueCustomerIdentifier" minOccurs="0" type="AlphaNumericString_Length1To10" />
380+ <xs:element name="infantIndicator" minOccurs="0" type="AlphaNumericString_Length1To1" />
381+ </xs:sequence>
382+ </xs:complexType>
383+ <xs:complexType name="TravellerInformationTypeI">
384+ <xs:annotation>
385+ <xs:documentation xml:lang="en">To specify a traveler(s) and personal details relating to the traveler(s).</xs:documentation>
386+ </xs:annotation>
387+ <xs:sequence>
388+ <xs:element name="paxDetails" type="TravellerSurnameInformationTypeI" />
389+ <xs:element name="otherPaxDetails" minOccurs="0" maxOccurs="99" type="TravellerDetailsTypeI" />
390+ </xs:sequence>
391+ </xs:complexType>
392+ <xs:complexType name="TravellerSurnameInformationTypeI">
393+ <xs:annotation>
394+ <xs:documentation xml:lang="en">Identification of the surname of a traveller, the type of traveller, number of travellers per surname and the action to be taken.</xs:documentation>
395+ </xs:annotation>
396+ <xs:sequence>
397+ <xs:element name="surname" type="AlphaNumericString_Length1To70" />
398+ <xs:element name="type" minOccurs="0" type="AlphaNumericString_Length1To3" />
399+ <xs:element name="quantity" minOccurs="0" type="NumericInteger_Length1To15" />
400+ </xs:sequence>
401+ </xs:complexType>
402+ <xs:simpleType name="AlphaNumericString_Length1To3">
403+ <xs:annotation>
404+ <xs:documentation xml:lang="en">Format limitations: an..3</xs:documentation>
405+ </xs:annotation>
406+ <xs:restriction base="xs:string">
407+ <xs:minLength value="1" />
408+ <xs:maxLength value="3" />
409+ </xs:restriction>
410+ </xs:simpleType>
411+ <xs:simpleType name="AlphaNumericString_Length1To35">
412+ <xs:annotation>
413+ <xs:documentation xml:lang="en">Format limitations: an..35</xs:documentation>
414+ </xs:annotation>
415+ <xs:restriction base="xs:string">
416+ <xs:minLength value="1" />
417+ <xs:maxLength value="35" />
418+ </xs:restriction>
419+ </xs:simpleType>
420+ <xs:simpleType name="AlphaNumericString_Length1To70">
421+ <xs:annotation>
422+ <xs:documentation xml:lang="en">Format limitations: an..70</xs:documentation>
423+ </xs:annotation>
424+ <xs:restriction base="xs:string">
425+ <xs:minLength value="1" />
426+ <xs:maxLength value="70" />
427+ </xs:restriction>
428+ </xs:simpleType>
429+ <xs:simpleType name="NumericInteger_Length1To15">
430+ <xs:annotation>
431+ <xs:documentation xml:lang="en">Format limitations: n..15</xs:documentation>
432+ </xs:annotation>
433+ <xs:restriction base="xs:integer">
434+ <xs:pattern value="-?[0-9]{1,15}" />
435+ </xs:restriction>
436+ </xs:simpleType>
437+ <xs:simpleType name="AlphaNumericString_Length1To8">
438+ <xs:annotation>
439+ <xs:documentation xml:lang="en">Format limitations: an..8</xs:documentation>
440+ </xs:annotation>
441+ <xs:restriction base="xs:string">
442+ <xs:minLength value="1" />
443+ <xs:maxLength value="8" />
444+ </xs:restriction>
445+ </xs:simpleType>
446+ <xs:simpleType name="NumericInteger_Length1To1">
447+ <xs:annotation>
448+ <xs:documentation xml:lang="en">Format limitations: n1</xs:documentation>
449+ </xs:annotation>
450+ <xs:restriction base="xs:integer">
451+ <xs:pattern value="-?[0-9]{1,1}" />
452+ </xs:restriction>
453+ </xs:simpleType>
454+ <xs:simpleType name="AlphaNumericString_Length1To25">
455+ <xs:annotation>
456+ <xs:documentation xml:lang="en">Format limitations: an..25</xs:documentation>
457+ </xs:annotation>
458+ <xs:restriction base="xs:string">
459+ <xs:minLength value="1" />
460+ <xs:maxLength value="25" />
461+ </xs:restriction>
462+ </xs:simpleType>
463+ <xs:simpleType name="AlphaNumericString_Length1To17">
464+ <xs:annotation>
465+ <xs:documentation xml:lang="en">Format limitations: an..17</xs:documentation>
466+ </xs:annotation>
467+ <xs:restriction base="xs:string">
468+ <xs:minLength value="1" />
469+ <xs:maxLength value="17" />
470+ </xs:restriction>
471+ </xs:simpleType>
472+ <xs:simpleType name="AlphaNumericString_Length1To7">
473+ <xs:annotation>
474+ <xs:documentation xml:lang="en">Format limitations: an..7</xs:documentation>
475+ </xs:annotation>
476+ <xs:restriction base="xs:string">
477+ <xs:minLength value="1" />
478+ <xs:maxLength value="7" />
479+ </xs:restriction>
480+ </xs:simpleType>
481+ <xs:simpleType name="AlphaNumericString_Length1To6">
482+ <xs:annotation>
483+ <xs:documentation xml:lang="en">Format limitations: an..6</xs:documentation>
484+ </xs:annotation>
485+ <xs:restriction base="xs:string">
486+ <xs:minLength value="1" />
487+ <xs:maxLength value="6" />
488+ </xs:restriction>
489+ </xs:simpleType>
490+ <xs:simpleType name="AlphaString_Length1To1">
491+ <xs:annotation>
492+ <xs:documentation xml:lang="en">Format limitations: a1</xs:documentation>
493+ </xs:annotation>
494+ <xs:restriction base="xs:string">
495+ <xs:minLength value="1" />
496+ <xs:maxLength value="1" />
497+ </xs:restriction>
498+ </xs:simpleType>
499+ <xs:simpleType name="NumericInteger_Length1To3">
500+ <xs:annotation>
501+ <xs:documentation xml:lang="en">Format limitations: n..3</xs:documentation>
502+ </xs:annotation>
503+ <xs:restriction base="xs:integer">
504+ <xs:pattern value="-?[0-9]{1,3}" />
505+ </xs:restriction>
506+ </xs:simpleType>
507+ <xs:simpleType name="AlphaNumericString_Length1To1">
508+ <xs:annotation>
509+ <xs:documentation xml:lang="en">Format limitations: an1</xs:documentation>
510+ </xs:annotation>
511+ <xs:restriction base="xs:string">
512+ <xs:minLength value="1" />
513+ <xs:maxLength value="1" />
514+ </xs:restriction>
515+ </xs:simpleType>
516+ <xs:simpleType name="AlphaNumericString_Length1To10">
517+ <xs:annotation>
518+ <xs:documentation xml:lang="en">Format limitations: an..10</xs:documentation>
519+ </xs:annotation>
520+ <xs:restriction base="xs:string">
521+ <xs:minLength value="1" />
522+ <xs:maxLength value="10" />
523+ </xs:restriction>
524+ </xs:simpleType>
525+ <xs:simpleType name="AlphaNumericString_Length1To12">
526+ <xs:annotation>
527+ <xs:documentation xml:lang="en">Format limitations: an..12</xs:documentation>
528+ </xs:annotation>
529+ <xs:restriction base="xs:string">
530+ <xs:minLength value="1" />
531+ <xs:maxLength value="12" />
532+ </xs:restriction>
533+ </xs:simpleType>
534+ <xs:simpleType name="NumericInteger_Length1To4">
535+ <xs:annotation>
536+ <xs:documentation xml:lang="en">Format limitations: n..4</xs:documentation>
537+ </xs:annotation>
538+ <xs:restriction base="xs:integer">
539+ <xs:pattern value="-?[0-9]{1,4}" />
540+ </xs:restriction>
541+ </xs:simpleType>
542+ <xs:simpleType name="AlphaNumericString_Length1To20">
543+ <xs:annotation>
544+ <xs:documentation xml:lang="en">Format limitations: an..20</xs:documentation>
545+ </xs:annotation>
546+ <xs:restriction base="xs:string">
547+ <xs:minLength value="1" />
548+ <xs:maxLength value="20" />
549+ </xs:restriction>
550+ </xs:simpleType>
551+ <xs:simpleType name="NumericInteger_Length1To9">
552+ <xs:annotation>
553+ <xs:documentation xml:lang="en">Format limitations: n..9</xs:documentation>
554+ </xs:annotation>
555+ <xs:restriction base="xs:integer">
556+ <xs:pattern value="-?[0-9]{1,9}" />
557+ </xs:restriction>
558+ </xs:simpleType>
559+ <xs:simpleType name="AlphaNumericString_Length1To9">
560+ <xs:annotation>
561+ <xs:documentation xml:lang="en">Format limitations: an..9</xs:documentation>
562+ </xs:annotation>
563+ <xs:restriction base="xs:string">
564+ <xs:minLength value="1" />
565+ <xs:maxLength value="9" />
566+ </xs:restriction>
567+ </xs:simpleType>
568+ <xs:simpleType name="AlphaNumericString_Length1To18">
569+ <xs:annotation>
570+ <xs:documentation xml:lang="en">Format limitations: an..18</xs:documentation>
571+ </xs:annotation>
572+ <xs:restriction base="xs:string">
573+ <xs:minLength value="1" />
574+ <xs:maxLength value="18" />
575+ </xs:restriction>
576+ </xs:simpleType>
577+ <xs:simpleType name="AMA_EDICodesetType_Length1to2">
578+ <xs:annotation>
579+ <xs:documentation xml:lang="en">Used for codes in the AMADEUS code tables. Code Length is two alphanumeric characters.</xs:documentation>
580+ </xs:annotation>
581+ <xs:restriction base="xs:string">
582+ <xs:pattern value="[0-9A-Z]{1,2}" />
583+ </xs:restriction>
584+ </xs:simpleType>
585+ <xs:simpleType name="Time24_HHMM">
586+ <xs:annotation>
587+ <xs:documentation xml:lang="en">Time format: 24H. All digits are mandatory . Example: from 0000 to 2359</xs:documentation>
588+ </xs:annotation>
589+ <xs:restriction base="xs:string">
590+ <xs:pattern value="([0-1][0-9]|2[0-3])[0-5][0-9]" />
591+ </xs:restriction>
592+ </xs:simpleType>
593+</xs:schema>
594+<!-- SchemaRules="2010/01"-->
595+<!--Created with SchemaBuilder 5.1.0 by Amadeus S.A.S.-->
596+<!--"Amadeus Proprietary and Confidential Information: unauthorized use and disclosure strictly forbidden. 2010 - Amadeus s.a.s - All Rights Reserved."-->
597+<!--Build Key:
598+1F8B080000000000000095534D6FDB4610BDEFAF58E49243218A8A8BA411B007C6A25D0395ED48CC4D8030E68EA44596BBECCED23063F8BF7796A46A1728D0F442CCC7723EDE7B735DDE969BA22A57FBBB5BF5215FFC3A5B2C661F72599DBA401A7A997F5E5EE4CBC52779BDAE7EC9F3659E8B625DC4BE45BA32161D34A838B0FF0264EA2A85B327D2E201086F39472DD4A84E31B6CBF9FCA9B11934A0B1A3ACF6CD5C3C744E5B5C99A0E684311A77A4B9363589FA84F5F72D7F1B503174286AAF919F9072DE25AF69D0B137E59A165C9FDA29D759CB81B60FE6788AEA5D31B693F7C1B7C16084D04B705A5E7A77309A6B18B0F2C61D7C68201AEF96B273D0C5930FE6076AD9110ECFB5A1DA7AEA024A8AC1D4D1F692FF79309A6B649281CBE54C9E9B51061925DF5AB9497390DCF0F4E11175F64E683C4067E37568135C5A1DC0120AEDBB078B5BFCB34357E33DC4FA3465D07DF92930D1BDBE794E04BDEC9F1F31106FC556408B5C862D387287FE451C98BE4D6719339F981CFC81CEE1E764FD4701EB6BB013E4D61F35D3B85AEE7E2F8BD5AED4E60075ACBCB7B42BABFDCA5004172F9929E68F99DBAD217CC7C4F8F88606AE69F7873F722D771C0631FACED95E34188E388131D85706ADA6AD0FF16FF87871E2B90A4A98FE33B662D68D9D94E3FE1744AD372EDE621CE918C416BC8F6F101AFC24E04C8C2B2444295D523ECF17538CAE7C28ACE1DA936293164C8DB46225716F16E58822351062AAFBCD99DAC47E5A24067064077D323E8AB1A6F954B92AD6F3678DD6F01AC0027AC9382BD278FAEDF9B0582ECF3733D6E4C800D570C9C6D5E2896CBCEB62DBC52B6F3506950242CC66EB11C6F724CDEB9DCC66620449DD14E24D7F55DC17FBC284FDE2E2236BBA01E3D4F6A612F8D4325D7BA0FDAABC56D5E65B79A647424050BF5D9C7DB55DDF6FCAAFA2E57B3074628647DC4772D482AD47931863730006060C556ABA413E4E7CE43382B886569C69FAD7E444BC5A5C88BF00DC744BCF06050000
599+-->
600+
test/fixtures/simple.xsdnew file+18
@@ -0,0 +1,18 @@
1+<?xml version="1.0"?>
2+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3+targetNamespace="https://www.w3schools.com"
4+xmlns="https://www.w3schools.com"
5+elementFormDefault="qualified">
6+
7+<xs:element name="note">
8+ <xs:complexType>
9+ <xs:sequence>
10+ <xs:element name="to" type="xs:string"/>
11+ <xs:element name="from" type="xs:string"/>
12+ <xs:element name="heading" type="xs:string"/>
13+ <xs:element name="body" type="xs:string"/>
14+ </xs:sequence>
15+ </xs:complexType>
16+</xs:element>
17+
18+</xs:schema>