git.iko.soy/typeable/xsd-parser
on master help sign in
Rework parser to support imports, includes and namespaces (#1)
commit9fadbc0aae568098ad19675338d5d849a9749a6e authorYuras <shumovichy@gmail.com> dateThu 6 Feb 2020, 14:43 (7 years ago) parent6881f2b
12 files changed+1024−2761
src/Text/XSD.hs−10 src/Text/XSD/Internal.hs−197 src/Text/XSD/Parser.hs−199 src/Xsd.hs+144 src/Xsd/Parser.hs+466 src/Xsd/Types.hs+139 test/Main.hs+2−16 test/Spec.hs+261 test/fixtures/enhanced_air_ticket.xsd−1702 test/fixtures/retrieve_seat_map.xml−600 test/fixtures/simple.xsd−18 xsd-parser.cabal+12−19
src/Text/XSD.hsdeleted−10
@@ -1,10 +0,0 @@
1−{-# LANGUAGE TemplateHaskell #-}
2−
3−-- | A subset of XSD specification.
4−module Text.XSD
5− ( module Text.XSD.Internal
6− , module Text.XSD.Parser
7− ) where
8−
9−import Text.XSD.Internal
10−import Text.XSD.Parser
src/Text/XSD/Internal.hsdeleted−197
@@ -1,197 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE TemplateHaskell #-}
3−
4−-- | A subset of XSD specification.
5−module Text.XSD.Internal where
6−
7−import Control.Exception
8−import Control.Lens
9−import Data.Text as T
10−import Data.Map as M
11−
12−
13−-- | Roughly based on https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes
14−-- | and https://www.w3.org/TR/xmlschema11-1/#dcl.ctd.ctsc
15−data Datatype
16− = TypeComplex ComplexType
17− | TypeSimple SimpleType
18− deriving (Show, Eq)
19−
20−data ComplexType
21− = ComplexType (Maybe Text) [Attribute] [Annotation] (Maybe ModelGroupSchema)
22− deriving (Show, Eq)
23−
24−data Attribute = Attribute Text SimpleType UseProp
25− deriving (Show, Eq)
26−
27−data UseProp
28− = Optional -- this is the default if missing in xsd
29− | Prohibited
30− | Required
31− deriving (Show, Eq)
32−
33−fromUsePropStr :: Text -> Maybe UseProp
34−fromUsePropStr "optional" = Just $ Optional
35−fromUsePropStr "required" = Just $ Required
36−fromUsePropStr "prohibited" = Just $ Prohibited
37−fromUsePropStr _ = Nothing
38−
39−data Annotation
40− = Documentation Text
41− deriving (Show, Eq)
42−
43−data DatatypeRef
44− = InlineComplex Datatype
45− | DatatypeRef Text
46− deriving (Show, Eq)
47−
48−-- | Based on https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#Model_Group_details
49−data ModelGroupSchema
50− = CTSequence [Element]
51− | CTChoice [Element]
52− | CTAll [Element]
53− deriving (Show, Eq)
54−
55−fromSimpleTypeStr :: QName -> Either String SimpleAtomicType
56−fromSimpleTypeStr (_, "anyURI") = Right $ STAnyURI
57−fromSimpleTypeStr (_, "base64Binary") = Right $ STBase64Binary
58−fromSimpleTypeStr (_, "boolean") = Right $ STBoolean
59−fromSimpleTypeStr (_, "date") = Right $ STDate
60−fromSimpleTypeStr (_, "datetime") = Right $ STDateTime
61−fromSimpleTypeStr (_, "dateTimeStamp") = Right $ STDateTimeStamp
62−fromSimpleTypeStr (_, "decimal") = Right $ STDecimal DTDecimal
63−fromSimpleTypeStr (_, "integer") = Right $ STDecimal DTInteger
64−fromSimpleTypeStr (_, "long") = Right $ STDecimal DTLong
65−fromSimpleTypeStr (_, "int") = Right $ STDecimal DTInt
66−fromSimpleTypeStr (_, "short") = Right $ STDecimal DTShort
67−fromSimpleTypeStr (_, "byte") = Right $ STDecimal DTByte
68−fromSimpleTypeStr (_, "nonNegativeInteger")= Right $ STDecimal DTNonNegativeInteger
69−fromSimpleTypeStr (_, "positiveInteger") = Right $ STDecimal DTPositiveInteger
70−fromSimpleTypeStr (_, "unsignedLong") = Right $ STDecimal DTUnsignedLong
71−fromSimpleTypeStr (_, "unsignedInt") = Right $ STDecimal DTUnsignedInt
72−fromSimpleTypeStr (_, "unsignedShort") = Right $ STDecimal DTUnsignedShort
73−fromSimpleTypeStr (_, "unsignedByte") = Right $ STDecimal DTUnsignedByte
74−fromSimpleTypeStr (_, "nonPositiveInteger")= Right $ STDecimal DTNonPositiveInteger
75−fromSimpleTypeStr (_, "negativeInteger") = Right $ STDecimal DTNegativeInteger
76−fromSimpleTypeStr (_, "float") = Right $ STFloat
77−fromSimpleTypeStr (_, "gDay") = Right $ STGDay
78−fromSimpleTypeStr (_, "gMonth") = Right $ STGMonth
79−fromSimpleTypeStr (_, "gMonthDay") = Right $ STGMonthDay
80−fromSimpleTypeStr (_, "gYear") = Right $ STGYear
81−fromSimpleTypeStr (_, "gYearMonth") = Right $ STGYearMonth
82−fromSimpleTypeStr (_, "hexBinary") = Right $ STHexBinary
83−fromSimpleTypeStr (_, "NOTATION") = Right $ STNOTATION
84−fromSimpleTypeStr (_, "QName") = Right $ STQName
85−fromSimpleTypeStr (_, "string") = Right $ STString StrString
86−fromSimpleTypeStr (_, "normalizedString") = Right $ STString StrNormalizedString
87−fromSimpleTypeStr (_, "token") = Right $ STString StrToken
88−fromSimpleTypeStr (_, "language") = Right $ STString StrLanguage
89−fromSimpleTypeStr (_, "Name") = Right $ STString StrName
90−fromSimpleTypeStr (_, "NCName") = Right $ STString StrNCName
91−fromSimpleTypeStr (_, "ENTITY") = Right $ STString StrENTITY
92−fromSimpleTypeStr (_, "ID") = Right $ STString StrID
93−fromSimpleTypeStr (_, "IDREF") = Right $ STString StrIDREF
94−fromSimpleTypeStr (_, "NMTOKEN") = Right $ STString StrNMTOKEN
95−fromSimpleTypeStr (_, "time") = Right $ STTime
96−fromSimpleTypeStr (_, t) = Left $ "unsupported type: " <> T.unpack t
97−
98−-- | ENTITIES, IDREFS and NMTOKENS are not supported right now.
99−data SimpleType
100− = STAtomic Text SimpleAtomicType [Annotation] [Restriction]
101− -- STUnion [SimpleType] -- special - xs:union
102− -- STList [SimpleType] -- special - xs:list
103− deriving (Show, Eq)
104−
105−data Restriction
106− = Enumeration [Text]
107− deriving (Show, Eq)
108−
109−data SimpleAtomicType
110− = STAnyURI
111− | STBase64Binary
112− | STBoolean
113− | STDate
114− | STDateTime
115− | STDateTimeStamp
116− | STDecimal DecimalType
117− | STDouble
118− | STDuration DurationType
119− | STFloat
120− | STGDay
121− | STGMonth
122− | STGMonthDay
123− | STGYear
124− | STGYearMonth
125− | STHexBinary
126− | STNOTATION
127− | STQName
128− | STString StringType
129− | STTime
130− deriving (Show, Eq)
131−
132−data StringType
133− = StrString
134− | StrNormalizedString
135− | StrToken
136− | StrLanguage
137− | StrName
138− | StrNCName
139− | StrENTITY
140− | StrID
141− | StrIDREF
142− | StrNMTOKEN
143− deriving (Show, Eq)
144−
145−data DurationType = DayTimeDuration | YearMonthDuration deriving (Show, Eq)
146−
147−data DecimalType
148− = DTDecimal
149− | DTInteger
150− | DTLong
151− | DTInt
152− | DTShort
153− | DTByte
154− | DTNonNegativeInteger
155− | DTPositiveInteger
156− | DTUnsignedLong
157− | DTUnsignedInt
158− | DTUnsignedShort
159− | DTUnsignedByte
160− | DTNonPositiveInteger
161− | DTNegativeInteger
162− deriving (Show, Eq)
163−
164−type LocalName = Text
165−
166−type Namespace = Text
167−
168−type QName = (Maybe Namespace, LocalName)
169−
170−toQName :: Text -> QName
171−toQName n =
172− let splitName@(f:l) = T.split (==':') n
173− in if Prelude.length splitName == 1
174− then (Nothing, f)
175− else (Just f, Prelude.head l)
176−
177−-- | Based on https://www.w3.org/TR/xmlschema11-1/#concepts-data-model
178−-- Secondary and helper schema components are not supported right now.
179−-- data SchemaComponent
180−-- = SCDatatype Datatype
181−-- | SCElement Element
182−-- | SCAttribute
183−-- deriving (Show)
184−
185−data Element = Element
186− { name :: !QName
187− , xtype :: !DatatypeRef
188− , minOccurs :: !Int
189− , maxOccurs :: !Int
190− , annotations :: [Annotation]
191− } deriving (Show, Eq)
192−
193−type DatatypeMap = M.Map Text Datatype
194−
195−-- | Embodies an XSD document
196−newtype XSD = XSD { unXSD :: ([Element], DatatypeMap) }
197− deriving (Show, Eq)
src/Text/XSD/Parser.hsdeleted−199
@@ -1,199 +0,0 @@
1−{-# LANGUAGE LambdaCase #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−
4−module Text.XSD.Parser where
5−
6−import Control.Exception
7−import Control.Monad
8−import Control.Monad.Except (throwError)
9−import Control.Monad.Trans.Reader
10−import Control.Monad.Writer.CPS
11−import Data.ByteString.Lazy
12−import Data.Foldable as F
13−-- import Data.Generics.Uniplate.Operations
14−import Data.Map as M
15−import Debug.Trace
16−import Data.Maybe
17−import Data.Text as T
18−import Prelude as P
19−import Text.XML as XML
20−import Text.XML.Cursor as XML
21−import Text.XSD.Internal as XSD
22−
23−
24−newtype XSDException = XSDException String
25− deriving (Show)
26−
27−instance Exception XSDException
28−
29−type XSDMonad a = WriterT DatatypeMap (Either SomeException) a
30−
31−parseXSD :: ParseSettings -> ByteString -> Either SomeException XSD
32−parseXSD ps bs = parseLBS ps bs >>= toXsd
33−
34−-- Show is Meh
35−throwXsd :: Show s => s -> XSDMonad a
36−throwXsd = throwError . SomeException . XSDException . show
37−
38−maybeThrowXsd :: Show s => Maybe a -> s -> XSDMonad a
39−maybeThrowXsd (Just a) _ = pure a
40−maybeThrowXsd Nothing e = throwXsd e
41−
42−attrThrowXsd :: Show s => XML.Name -> XML.Element -> s -> XSDMonad Text
43−attrThrowXsd name elNode = maybeThrowXsd (M.lookup name $ elementAttributes elNode)
44−
45−-- | Tells the writer about named complex types and returns a list of elements.
46−toElemsAndDatatypes :: XML.Cursor -> XSDMonad [XSD.Element]
47−toElemsAndDatatypes cursor = do
48− elems <- traverse toElem (cursor $/ laxElement "element")
49− complexDatatypes <- traverse toComplexType (cursor $/ laxElement "complexType")
50− for_ complexDatatypes $ \case
51− datatype@(ComplexType (Just name) _ _ _) ->
52− tell (M.singleton name (TypeComplex datatype))
53− datatype@(ComplexType Nothing _ _ _) ->
54− throwXsd $ "unnamed type ref for datatype: " <> show datatype
55− simpleTypes <- traverse toSimpleType (cursor $/ laxElement "simpleType")
56− for_ simpleTypes $ \simpleType@(STAtomic name _ _ _) ->
57− tell (M.singleton name (TypeSimple simpleType))
58− pure elems
59−
60−safeHead :: [a] -> Maybe a
61−safeHead [] = Nothing
62−safeHead (a:_) = Just a
63−
64−getDocumentation :: Cursor -> [Annotation]
65−getDocumentation cursor = Documentation <$> documentation
66− where
67− documentation = cursor
68− $/ laxElement "annotation"
69− &// laxElement "documentation"
70− &/ content
71−
72−-- | Takes a cursor to the element itself.
73−toElem :: Cursor -> XSDMonad XSD.Element
74−toElem cursor = do
75− case node cursor of
76− NodeElement el -> case nameLocalName (elementName el) of
77− "element" -> do
78− let
79− attrs = elementAttributes el
80− mAttrType = M.lookup "type" attrs
81− ns = nameNamespace $ elementName el
82− name <- attrThrowXsd "name" el
83− $ "Expected attribute 'name' for element: " <> show (node cursor)
84− let
85− -- https://www.w3.org/TR/xmlschema-1/#cElement_Declarations
86− -- https://www.w3.org/TR/xmlschema-1/#declare-element
87− minOc = maybe 1 (read . T.unpack) (M.lookup "minOccurs" attrs)
88− maxOc = maybe 1 (read . T.unpack) (M.lookup "maxOccurs" attrs)
89− datatypeRef <- case mAttrType of
90− Just dtn -> pure $ DatatypeRef dtn
91− Nothing -> do
92− let complexType = cursor $// laxElement "complexType"
93− if P.null complexType
94− then throwXsd $ "No datatype definition found for element: " <> name
95− else do
96− childCursor <- maybeThrowXsd (safeHead complexType)
97− $ "More than one xs:complexType tag in: " <> show cursor
98− let name = safeHead $ childCursor $| attribute "name"
99− InlineComplex . TypeComplex <$> toComplexType childCursor
100− pure $ XSD.Element
101− { name = (ns, name)
102− , xtype = datatypeRef
103− , minOccurs = minOc
104− , maxOccurs = maxOc
105− , annotations = getDocumentation cursor }
106− e -> throwXsd $ "[toElem] xsd node not supported: " <> show e
107− e ->
108− throwXsd $ "[toElem] element expected, got: " <> show e
109−
110−toSimpleType :: Cursor -> XSDMonad SimpleType
111−toSimpleType cursor = do
112− name <- maybeThrowXsd
113− (safeHead $ cursor $| attribute "name")
114− $ "More than one \"name\" attribute in simpleType declaration"
115− let restrictionAxis = laxElement "restriction"
116− if P.null (cursor $// restrictionAxis)
117− then throwXsd $ "unsupported simpleType element: " <> show cursor
118− else do
119− childCursor <- maybeThrowXsd (safeHead $ cursor $// restrictionAxis)
120− $ "Unexpected number of <restriction> tags in: " <> show cursor
121− baseType <- maybeThrowXsd (safeHead $ childCursor $| attribute "base")
122− $ "No base attribute provided for restriction tag in: " <> show cursor
123− let
124− enumValues = childCursor $// laxElement "enumeration" &/ attribute "value"
125− -- only enumeration is supported now
126− case fromSimpleTypeStr $ toQName baseType of
127− Left e -> throwXsd e
128− Right simpleAtomicType ->
129− pure $ STAtomic name simpleAtomicType
130− (getDocumentation cursor)
131− $ if P.null enumValues then [] else [Enumeration enumValues]
132−
133−-- | Takes a cursor to the 'xs:complexType' element.
134−toComplexType :: Cursor -> XSDMonad ComplexType
135−toComplexType cursor = do
136− let attributeAxis = laxElement "attribute"
137− let sequenceAxis = laxElement "sequence"
138− let choiceAxis = laxElement "choice"
139− let allAxis = laxElement "all"
140− -- attributes
141− attrs <- traverse toAttribute (cursor $// attributeAxis)
142− let ann = getDocumentation cursor
143− -- group model schemas
144− if P.null (cursor $// sequenceAxis)
145− then if P.null (cursor $// choiceAxis)
146− then if P.null (cursor $// allAxis)
147− then throwXsd $ "No definition found for complexType: "
148− <> show (safeHead $ cursor $// laxElement "complexType")
149− else do
150− childCursor <- maybeThrowXsd (safeHead $ cursor $// allAxis)
151− $ "Unexpected number of xs:all tags in: " <> show cursor
152− let
153− name = safeHead $ cursor $| attribute "name"
154− ComplexType name attrs ann . Just . CTAll <$> toElemsAndDatatypes childCursor
155− else do
156− childCursor <- maybeThrowXsd (safeHead $ cursor $// choiceAxis)
157− $ "Unexpected number of xs:choice tags in: " <> show cursor
158− let
159− name = safeHead $ cursor $| attribute "name"
160− ComplexType name attrs ann . Just . CTChoice <$> toElemsAndDatatypes childCursor
161− else do
162− childCursor <- maybeThrowXsd (safeHead $ cursor $// sequenceAxis)
163− $ "Unexpected number of xs:sequence tags in: " <> show cursor
164− let
165− name = safeHead $ cursor $| attribute "name"
166− ComplexType name attrs ann . Just . CTSequence <$> toElemsAndDatatypes childCursor
167−
168−toAttribute :: XML.Cursor -> XSDMonad Attribute
169−toAttribute cursor = do
170− name <- maybeThrowXsd (safeHead $ cursor $| attribute "name")
171− $ "No name attribute found in child <attribute> of: "
172− <> show (cursor $| ancestor <=< ancestor)
173− let ann = getDocumentation cursor
174− simpleType <- case safeHead $ cursor $| attribute "type" of
175− Just simpleAtomicType ->
176− case fromSimpleTypeStr $ toQName simpleAtomicType of
177− Left e -> throwXsd e
178− Right simpleAtomicType -> pure $ STAtomic name simpleAtomicType ann []
179− Nothing -> do
180− let simpleTypeCursor = safeHead $ cursor $// laxElement "simpleType"
181− case simpleTypeCursor of
182− Just st -> toSimpleType cursor
183− Nothing -> throwXsd
184− $ "No type attribute found in child <attribute> of: "
185− <> show (cursor $| ancestor <=< ancestor)
186− let
187− useProp = case fromUsePropStr =<< safeHead (cursor $| attribute "use") of
188− Just up -> up
189− Nothing -> Optional
190− pure $ Attribute name simpleType useProp
191−
192−toXsd :: Document -> Either SomeException XSD
193−toXsd doc = do
194− let cursor = fromDocument doc
195− XSD <$> (runWriterT $ do
196− let topLevel = cursor $| laxElement "schema"
197− if P.null topLevel
198− then throwXsd "Top-level schema definition not found"
199− else toElemsAndDatatypes cursor)
src/Xsd.hsnew file+144
@@ -0,0 +1,144 @@
1+
2+module Xsd
3+( module Xsd.Types
4+, module Xsd.Parser
5+, Schema(..)
6+, getSchema
7+, mergeSchemata
8+)
9+where
10+
11+import qualified Data.Text as Text
12+import Data.Maybe
13+import Data.Map (Map)
14+import qualified Data.Map as Map
15+import qualified Data.Set as Set
16+import Control.Monad.IO.Class
17+import Control.Monad.Trans.State
18+import Network.URI (URI)
19+import qualified Network.URI as URI
20+import qualified Network.HTTP.Client as Http
21+import qualified Network.HTTP.Client.TLS as Http
22+import System.FilePath
23+
24+import Xsd.Types
25+import Xsd.Parser
26+
27+data Schema = Schema
28+ { schemaTypes :: Map QName Type
29+ , schemaElements :: Map QName Element
30+ }
31+ deriving (Show)
32+
33+emptySchema :: Schema
34+emptySchema = Schema
35+ { schemaTypes = Map.empty
36+ , schemaElements = Map.empty
37+ }
38+
39+mergeSchemata :: Schema -> Schema -> Schema
40+mergeSchemata s1 s2 = Schema
41+ { schemaTypes = schemaTypes s1 <> schemaTypes s2
42+ , schemaElements = schemaElements s1 <> schemaElements s2
43+ }
44+
45+instance Semigroup Schema where
46+ (<>) = mergeSchemata
47+
48+instance Monoid Schema where
49+ mempty = emptySchema
50+
51+-- | Get schema from file or URL
52+getSchema :: String -> IO Schema
53+getSchema source = do
54+ uri <- maybe (fail "Can't parse the source URI") return
55+ (URI.parseURIReference source)
56+ mconcat <$> evalStateT (go uri []) Set.empty
57+ where
58+ go uri schemata = do
59+ skip <- gets (Set.member uri)
60+ if skip
61+ then return schemata
62+ else do
63+ xsd <- liftIO $ fetchXsd uri
64+ modify' (Set.insert uri)
65+ let
66+ schema = xsdToSchema xsd
67+ includes = flip mapMaybe (children xsd) $ \c -> case c of
68+ ChildInclude i -> Just i
69+ _ -> Nothing
70+ imports = flip mapMaybe (children xsd) $ \c -> case c of
71+ ChildImport i -> Just i
72+ _ -> Nothing
73+ goInclude uri includes (schema:schemata)
74+ >>= goImports uri imports
75+
76+ goInclude _ [] schemata = return schemata
77+ goInclude uri (i:is) schemata = do
78+ let location = includeLocation i
79+ uri' <- maybe
80+ (fail ("Can't parse the location URI " <> show location))
81+ (\u -> return $ combineURIs uri u )
82+ (URI.parseURIReference (Text.unpack location))
83+ go uri' schemata
84+ >>= goInclude uri is
85+
86+ goImports _ [] schemata = return schemata
87+ goImports uri (i:is) schemata =
88+ case importLocation i of
89+ Nothing -> goImports uri is schemata
90+ Just location -> do
91+ uri' <- maybe
92+ (fail ("Can't parse the location URI " <> show location))
93+ (\u -> return $ combineURIs uri u)
94+ (URI.parseURIReference (Text.unpack location))
95+ go uri' schemata
96+ >>= goImports uri is
97+
98+-- | If the second URI is relative, then make it relative to the first one
99+combineURIs :: URI -> URI -> URI
100+combineURIs u1 u2 = if URI.uriIsAbsolute u2
101+ then u2
102+ else if isLocal u1
103+ then u1 {URI.uriPath = dropFileName (URI.uriPath u1) </> URI.uriPath u2}
104+ else u2 `URI.relativeTo` u1
105+
106+xsdToSchema :: Xsd -> Schema
107+xsdToSchema xsd = Schema
108+ { schemaTypes = Map.fromList types
109+ , schemaElements = Map.fromList elements
110+ }
111+ where
112+ (types, elements) = go ([], []) (children xsd)
113+ go res [] = res
114+ go (ts, es) (c:cs) = case c of
115+ ChildType n t -> go ((n, t):ts, es) cs
116+ ChildElement e -> go (ts, (elementName e, e):es) cs
117+ _ -> go (ts, es) cs
118+
119+fetchXsd :: URI -> IO Xsd
120+fetchXsd uri = do
121+ let
122+ path = URI.uriToString id uri ""
123+ onParseErr e = fail $ path ++ ": " ++ show e
124+ if isLocal uri
125+ then
126+ parseFile path
127+ >>= either onParseErr return
128+ else fetchHttp path
129+
130+fetchHttp :: String -> IO Xsd
131+fetchHttp url = do
132+ mgr <- Http.newTlsManager
133+ req <- Http.parseUrlThrow url
134+ resp <- Http.responseBody <$> Http.httpLbs req mgr
135+ either onErr return $
136+ parseLazyByteString resp
137+ where
138+ onErr e = fail $ url ++ ": " ++ show e
139+
140+isLocal :: URI -> Bool
141+isLocal uri = case URI.uriScheme uri of
142+ "http:" -> False
143+ "https:" -> False
144+ _ -> True
src/Xsd/Parser.hsnew file+466
@@ -0,0 +1,466 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Xsd.Parser
4+( parse
5+, parseFile
6+, parseLazyByteString
7+, ParseError(..)
8+, Config(..)
9+, defaultConfig
10+)
11+where
12+
13+import qualified Data.ByteString.Lazy as Lazy (ByteString)
14+import Data.Text (Text)
15+import qualified Data.Text as Text
16+import Data.Maybe
17+import qualified Data.Map as Map
18+import Control.Monad
19+import Control.Monad.Trans
20+import Control.Monad.Trans.Reader
21+import Control.Monad.Trans.Except
22+import Text.Read (readEither)
23+import Text.XML
24+import Text.XML.Cursor
25+
26+import Xsd.Types (Xsd(Xsd))
27+import qualified Xsd.Types as Xsd
28+
29+parseSchema :: Cursor -> P Xsd
30+parseSchema c = do
31+ let targetNamespace = Xsd.Namespace <$> anAttribute "targetNamespace" c
32+
33+ children <- local (\env -> env {envTargetNamespace = targetNamespace}) $
34+ parseChildren c
35+ return Xsd
36+ { Xsd.targetNamespace = targetNamespace
37+ , Xsd.children = children
38+ }
39+
40+parseChildren :: Cursor -> P [Xsd.Child]
41+parseChildren c =
42+ catMaybes <$> mapM parseChild (c $/ anyElement)
43+
44+-- | Parse top level schema node
45+--
46+-- Returns Nothing for unknown/unsupported nodes
47+parseChild :: Cursor -> P (Maybe Xsd.Child)
48+parseChild c = do
49+ name <- getElementName c
50+ case name of
51+ "element" -> Just . Xsd.ChildElement <$> parseElement c
52+ "simpleType" -> Just <$> parseTopSimpleType c
53+ "complexType" -> Just <$> parseTopComplexType c
54+ "include" -> Just . Xsd.ChildInclude <$> parseInclude c
55+ "import" -> Just . Xsd.ChildImport <$> parseImport c
56+ _ -> return Nothing
57+
58+parseInclude :: Cursor -> P Xsd.Include
59+parseInclude c = do
60+ location <- theAttribute "schemaLocation" c
61+ return Xsd.Include
62+ { Xsd.includeLocation = location
63+ }
64+
65+parseImport :: Cursor -> P Xsd.Import
66+parseImport c = do
67+ let
68+ location = anAttribute "schemaLocation" c
69+ namespace = Xsd.Namespace <$> anAttribute "namespace" c
70+
71+ tns <- asks envTargetNamespace
72+ case (namespace, tns) of
73+ (Nothing, Nothing) -> parseError c "Expected namespace"
74+ (Just ns1, Just ns2)
75+ | ns1 == ns2
76+ -> parseError c "Namespace equals target namespace"
77+ _ -> return ()
78+
79+ return Xsd.Import
80+ { Xsd.importLocation = location
81+ , Xsd.importNamespace = namespace
82+ }
83+
84+parseElement :: Cursor -> P Xsd.Element
85+parseElement c = handleNamespaces c $ do
86+ name <- theAttribute "name" c
87+
88+ -- XXX: generalaze RefOr parsing
89+ tp <- case anAttribute "type" c of
90+ Just t -> Xsd.Ref <$> makeQName c t
91+ _ -> Xsd.Inline <$> parseType c
92+
93+ minOccurs <- case anAttribute "minOccurs" c of
94+ Nothing -> return 1
95+ Just val -> case readEither (Text.unpack val) of
96+ Left err -> parseError c ("Can't parse minOccurs: " <> Text.pack err)
97+ Right v -> return v
98+
99+ maxOccurs <- case anAttribute "maxOccurs" c of
100+ Nothing -> return (Xsd.MaxOccurs 1)
101+ Just "unbounded" -> return Xsd.MaxOccursUnbound
102+ Just val -> case readEither (Text.unpack val) of
103+ Left err -> parseError c ("Can't parse maxOccurs" <> Text.pack err)
104+ Right v -> return (Xsd.MaxOccurs v)
105+
106+ annotations <- parseAnnotations c
107+
108+ qname <- makeTargetQName name
109+
110+ return Xsd.Element
111+ { Xsd.elementName = qname
112+ , Xsd.elementType = tp
113+ , Xsd.elementAnnotations = annotations
114+ , Xsd.elementOccurs = (minOccurs, maxOccurs)
115+ }
116+
117+-- | Parse inline type, simple or complex
118+parseType :: Cursor -> P Xsd.Type
119+parseType c = do
120+ simpleTypeAxis <- makeElemAxis "simpleType"
121+ complexTypeAxis <- makeElemAxis "complexType"
122+ case (c $/ simpleTypeAxis, c $/ complexTypeAxis) of
123+ ([], []) -> parseError c "No type"
124+ ([t], []) -> Xsd.TypeSimple <$> parseSimpleType t
125+ ([], [t]) -> Xsd.TypeComplex <$> parseComplexType t
126+ _ -> parseError c "Multiple types"
127+
128+-- | Top level simple type
129+parseTopSimpleType :: Cursor -> P Xsd.Child
130+parseTopSimpleType c = do
131+ name <- theAttribute "name" c >>= makeTargetQName
132+ t <- parseSimpleType c
133+ return $ Xsd.ChildType name (Xsd.TypeSimple t)
134+
135+-- | Top level complex type
136+parseTopComplexType :: Cursor -> P Xsd.Child
137+parseTopComplexType c = do
138+ name <- theAttribute "name" c >>= makeTargetQName
139+ t <- parseComplexType c
140+ return $ Xsd.ChildType name (Xsd.TypeComplex t)
141+
142+parseSimpleType :: Cursor -> P Xsd.SimpleType
143+parseSimpleType c = do
144+ restrictionAxis <- makeElemAxis "restriction"
145+ listAxis <- makeElemAxis "list"
146+ unionAxis <- makeElemAxis "union"
147+ case (c $/ restrictionAxis, c $/ listAxis, c $/ unionAxis) of
148+ ([e], [], []) -> Xsd.AtomicType
149+ <$> parseRestriction e
150+ <*> parseAnnotations c
151+ ([], [l], []) -> Xsd.ListType
152+ <$> parseList l
153+ <*> parseAnnotations c
154+ -- TODO implement me
155+ ([], [], [_]) -> parseError c "Not implemented: union"
156+ _ -> parseError c "Expected exactly of of restriction, list or union"
157+
158+-- | Restriction for simple type
159+parseRestriction :: Cursor -> P Xsd.Restriction
160+parseRestriction c = do
161+ -- XXX: generalaze RefOr parsing
162+ tp <- case anAttribute "base" c of
163+ Nothing -> do
164+ simpleTypeAxis <- makeElemAxis "simpleType"
165+ case c $/ simpleTypeAxis of
166+ [] -> parseError c "Expected simpleType"
167+ [s] -> Xsd.Inline <$> parseSimpleType s
168+ _ -> parseError c "Multiple types"
169+ Just t -> Xsd.Ref <$> makeQName c t
170+
171+ return Xsd.Restriction
172+ { Xsd.restrictionBase = tp
173+ , Xsd.restrictionConstraints = [] -- TODO: implement me
174+ }
175+
176+parseList :: Cursor -> P (Xsd.RefOr Xsd.SimpleType)
177+parseList c =
178+ -- XXX: generalaze RefOr parsing
179+ case anAttribute "itemType" c of
180+ Nothing -> do
181+ simpleTypeAxis <- makeElemAxis "simpleType"
182+ case c $/ simpleTypeAxis of
183+ [] -> parseError c "Expected simpleType"
184+ [s] -> Xsd.Inline <$> parseSimpleType s
185+ _ -> parseError c "Multiple types"
186+ Just t -> Xsd.Ref <$> makeQName c t
187+
188+parseComplexType :: Cursor -> P Xsd.ComplexType
189+parseComplexType c = do
190+ attrAxis <- makeElemAxis "attribute"
191+ attributes <- mapM parseAttribute (c $/ attrAxis)
192+
193+ group <- do
194+ sequenceAxis <- makeElemAxis "sequence"
195+ choiceAxis <- makeElemAxis "choice"
196+ allAxis <- makeElemAxis "all"
197+ case (c $/ sequenceAxis, c $/ choiceAxis, c $/ allAxis) of
198+ ([], [], []) -> return Nothing
199+ ([g], [], []) -> Just <$> parseSequence g
200+ ([], [g], []) -> Just <$> parseChoice g
201+ ([], [], [g]) -> Just <$> parseAll g
202+ _ -> parseError c "Multiple groups"
203+
204+ annotations <- parseAnnotations c
205+
206+ return Xsd.ComplexType
207+ { Xsd.complexAttributes = attributes
208+ , Xsd.complexModelGroup = group
209+ , Xsd.complexAnnotations = annotations
210+ }
211+
212+parseSequence :: Cursor -> P Xsd.ModelGroup
213+parseSequence c = Xsd.Sequence <$> parseElements c
214+
215+parseChoice :: Cursor -> P Xsd.ModelGroup
216+parseChoice c = Xsd.Choice <$> parseElements c
217+
218+parseAll :: Cursor -> P Xsd.ModelGroup
219+parseAll c = Xsd.All <$> parseElements c
220+
221+-- | Get all child elements
222+parseElements :: Cursor -> P [Xsd.Element]
223+parseElements c = do
224+ elementAxis <- makeElemAxis "element"
225+ mapM parseElement (c $/ elementAxis)
226+
227+parseAttribute :: Cursor -> P Xsd.Attribute
228+parseAttribute c = do
229+ name <- theAttribute "name" c >>= makeTargetQName
230+ use <- parseUseAttribute c
231+
232+ -- XXX: generalaze RefOr parsing
233+ tp <- case anAttribute "type" c of
234+ Nothing -> do
235+ simpleTypeAxis <- makeElemAxis "simpleType"
236+ case c $/ simpleTypeAxis of
237+ [s] -> Xsd.Inline <$> parseSimpleType s
238+ [] -> parseError c "Attribute should have type"
239+ _ -> parseError c "Multiple simple types"
240+ Just t -> Xsd.Ref <$> makeQName c t
241+
242+ return Xsd.Attribute
243+ { Xsd.attrName = name
244+ , Xsd.attrUse = use
245+ , Xsd.attrType = tp
246+ }
247+
248+parseUseAttribute :: Cursor -> P Xsd.Use
249+parseUseAttribute c = case anAttribute "use" c of
250+ Nothing -> return Xsd.Optional
251+ Just "optional" -> return Xsd.Optional
252+ Just "required" -> return Xsd.Required
253+ Just "prohibited" -> return Xsd.Prohibited
254+ _ -> parseError c "Unknown attribute use"
255+
256+parseAnnotations :: Cursor -> P [Xsd.Annotation]
257+parseAnnotations c = do
258+ annotationAxis <- makeElemAxis "annotation"
259+ documentationAxis <- makeElemAxis "documentation"
260+
261+ let
262+ documentation = c
263+ $/ annotationAxis
264+ &// documentationAxis
265+ &/ content
266+ return $ Xsd.Documentation <$> documentation
267+
268+-- Section: parser entry points
269+
270+-- | Specifies modes of operation
271+data Config = Config
272+ { configIgnoreSchemaNamespace :: Bool
273+ -- ^ if not set, parser will check that all relevant xml nodes
274+ -- live is the correct XMLSchema namespace
275+ }
276+ deriving (Show)
277+
278+-- | Default configuration
279+defaultConfig :: Config
280+defaultConfig = Config
281+ { configIgnoreSchemaNamespace = False
282+ }
283+
284+-- | Parse the whole document
285+--
286+-- Make sure the document is parsed with `psRetainNamespaces` enabled!
287+parse :: Config -> Document -> Either ParseError Xsd
288+parse conf doc = do
289+ let
290+ env = Env
291+ { envConfig = conf
292+ , envTargetNamespace = Nothing
293+ , envPrefixes = []
294+ }
295+ c = fromDocument doc
296+ runExcept $ flip runReaderT env $ handleNamespaces c $ do
297+ schemaAxis <- makeElemAxis "schema"
298+ case c $.// schemaAxis of
299+ [] -> parseError c "Not schema found"
300+ [s] -> parseSchema s
301+ _ -> parseError c "Multiple schemata found"
302+
303+-- | Parse file
304+--
305+-- It uses the `defaultConfig`
306+parseFile :: FilePath -> IO (Either ParseError Xsd)
307+parseFile path = parse defaultConfig <$>
308+ Text.XML.readFile def{psRetainNamespaces=True} path
309+
310+parseLazyByteString :: Lazy.ByteString -> Either ParseError Xsd
311+parseLazyByteString = parse defaultConfig
312+ . parseLBS_ def{psRetainNamespaces=True}
313+
314+-- Section: parser environment
315+
316+-- | Namespace prefix, e.g. \"xs\" or \"tns\"
317+newtype Prefix = Prefix Text
318+ deriving (Show, Eq)
319+
320+-- | Parser environment
321+data Env = Env
322+ { envConfig :: Config
323+ , envTargetNamespace :: Maybe Xsd.Namespace
324+ -- ^ targetNamespace for the current schema
325+ , envPrefixes :: [(Maybe Prefix, Xsd.Namespace)]
326+ -- ^ all xmlns:prefix="namespace" things from the
327+ -- schema element
328+ }
329+ deriving (Show)
330+
331+-- | Parser
332+type P a = ReaderT Env (Except ParseError) a
333+
334+-- Section: error handling
335+
336+-- | Describes what exactly went wrong
337+data ParseError = ParseError
338+ { errorLocation :: Text
339+ -- ^ e.g. schema.element[Person].attribute[firstName]
340+ , errorMessage :: Text
341+ }
342+ deriving (Show)
343+
344+-- | Builds path to the current curson position
345+--
346+-- Goes through parents and collects their element names,
347+-- optionally adds value of "name" attribute
348+pprCursor :: Cursor -> Text
349+pprCursor = Text.intercalate "." . go []
350+ where
351+ go ctx c = case node c of
352+ NodeElement e ->
353+ let
354+ ctx' = name : ctx
355+ elemName = nameLocalName (elementName e)
356+ name = case laxAttribute "name" c of
357+ (n:_) -> elemName <> "[" <> n <> "]"
358+ _ -> elemName
359+ in case parent c of
360+ (p:_) -> go ctx' p
361+ _ -> ctx'
362+ _ -> ctx
363+
364+-- | Fail with the location and message
365+parseError :: Cursor -> Text -> P a
366+parseError c msg = lift $ throwE ParseError
367+ { errorLocation = pprCursor c
368+ , errorMessage = msg
369+ }
370+
371+-- Section: general utilities
372+
373+-- | Get value of an optional attribute
374+anAttribute :: Text -> Cursor -> Maybe Text
375+anAttribute name c = case c $| laxAttribute name of
376+ (a:_) -> Just a
377+ _ -> Nothing
378+
379+-- | Get value of the required attribute
380+theAttribute :: Text -> Cursor -> P Text
381+theAttribute name c = maybe err return (anAttribute name c)
382+ where
383+ err = parseError c ("Element should have attibute " <> name)
384+
385+-- | Select nodes with the specified name
386+--
387+-- Depending on the `configIgnoreSchemaNamespace`, it will or will not
388+-- check the namespace to be XMLSchema one
389+makeElemAxis :: Text -> P Axis
390+makeElemAxis name = do
391+ ignore <- asks (configIgnoreSchemaNamespace . envConfig)
392+ return $ if ignore
393+ then laxElement name
394+ else element (mkSchemaName name)
395+
396+-- | Parses reference to a type
397+--
398+-- Fails if it has a prefix which is not bound
399+makeQName :: Cursor -> Text -> P Xsd.QName
400+makeQName c t = case Text.splitOn ":" t of
401+ [n] -> do
402+ return Xsd.QName
403+ { Xsd.qnNamespace = Nothing
404+ , Xsd.qnName = n
405+ }
406+ [p, n] -> do
407+ known <- asks (lookup (Just (Prefix p)) . envPrefixes)
408+ case known of
409+ Nothing -> parseError c "Unbound prefix"
410+ _ -> return ()
411+ return Xsd.QName
412+ { Xsd.qnNamespace = known
413+ , Xsd.qnName = n
414+ }
415+ _ -> parseError c ("Can't parse name " <> t)
416+
417+makeTargetQName :: Text -> P Xsd.QName
418+makeTargetQName name = do
419+ tns <- asks envTargetNamespace
420+ return Xsd.QName
421+ { Xsd.qnNamespace = tns
422+ , Xsd.qnName = name
423+ }
424+
425+-- | Get name of the current node
426+--
427+-- Depending on `configIgnoreSchemaNamespace` value, it will or will not
428+-- check the namespace to be XMLSchema one
429+getElementName :: Cursor -> P Text
430+getElementName c = do
431+ case node c of
432+ NodeElement e -> do
433+ let name = elementName e
434+ ignore <- asks (configIgnoreSchemaNamespace . envConfig)
435+ unless ignore $ do
436+ when (nameNamespace name /= Just Xsd.schemaNamespace) $ do
437+ parseError c "Expected XMLSchema element"
438+ return (nameLocalName name)
439+ _ -> parseError c "Expected node element here"
440+
441+-- | Attaches xml schema namespace
442+mkSchemaName :: Text -> Name
443+mkSchemaName name = Name name (Just Xsd.schemaNamespace) Nothing
444+
445+-- | Add additional xmlns bindings into local scope
446+handleNamespaces :: Cursor -> P a -> P a
447+handleNamespaces c m = do
448+ ns <- parsePrefixes c
449+ local (\env -> env {envPrefixes = ns ++ envPrefixes env}) m
450+
451+-- | Parse namespace bindings
452+--
453+-- Cursor should point to schema node
454+parsePrefixes :: Cursor -> P [(Maybe Prefix, Xsd.Namespace)]
455+parsePrefixes c = case node c of
456+ NodeElement e -> return
457+ . concatMap toPrefix
458+ . Map.toList
459+ . elementAttributes
460+ $ e
461+ _ -> parseError c "Expected an element"
462+ where
463+ toPrefix (n, v) = case Text.splitOn ":" (nameLocalName n) of
464+ ["xmlns"] -> [(Nothing, Xsd.Namespace v)]
465+ ["xmlns", prefix] -> [(Just (Prefix prefix), Xsd.Namespace v)]
466+ _ -> []
src/Xsd/Types.hsnew file+139
@@ -0,0 +1,139 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Xsd.Types
4+( Xsd(..)
5+, Namespace(..)
6+, Child(..)
7+, Type(..)
8+, SimpleType(..)
9+, Restriction(..)
10+, ComplexType(..)
11+, RefOr(..)
12+, Element(..)
13+, MaxOccurs(..)
14+, Attribute(..)
15+, Annotation(..)
16+, Use(..)
17+, ModelGroup(..)
18+, Import(..)
19+, Include(..)
20+, QName(..)
21+, schemaNamespace
22+)
23+where
24+
25+import Data.Text (Text)
26+
27+data Xsd = Xsd
28+ { targetNamespace :: Maybe Namespace
29+ , children :: [Child]
30+ -- XXX: Investigate whether there could be any dependency on the order
31+ -- on children. E.g whether an element can reference type from other
32+ -- namespace only after the namespace is imported.
33+ -- If there is no such dependency, then get rid of Child and list
34+ -- types and elements separately here.
35+ }
36+ deriving (Show, Eq)
37+
38+-- | Namespace name, e.g. \"http://www.w3.org/2001/XMLSchema\"
39+newtype Namespace = Namespace
40+ { fromNamespace :: Text
41+ }
42+ deriving (Show, Eq, Ord)
43+
44+data Child
45+ = ChildElement Element
46+ | ChildType QName Type
47+ | ChildImport Import
48+ | ChildInclude Include
49+ deriving (Show, Eq)
50+
51+data Annotation = Documentation Text
52+ deriving (Show, Eq)
53+
54+data Element = Element
55+ { elementName :: QName
56+ , elementType :: RefOr Type
57+ , elementOccurs :: (Int, MaxOccurs)
58+ , elementAnnotations :: [Annotation]
59+ }
60+ deriving (Show, Eq)
61+
62+data MaxOccurs
63+ = MaxOccurs Int
64+ | MaxOccursUnbound
65+ deriving (Show, Eq)
66+
67+data Type
68+ = TypeSimple SimpleType
69+ | TypeComplex ComplexType
70+ deriving (Show, Eq)
71+
72+data Import = Import
73+ { importNamespace :: Maybe Namespace
74+ , importLocation :: Maybe Text
75+ }
76+ deriving (Show, Eq)
77+
78+data Include = Include
79+ { includeLocation :: Text
80+ }
81+ deriving (Show, Eq)
82+
83+data SimpleType
84+ = AtomicType Restriction [Annotation]
85+ | ListType (RefOr SimpleType) [Annotation]
86+ -- TODO: also union
87+ deriving (Show, Eq)
88+
89+data ComplexType = ComplexType
90+ { complexAttributes :: [Attribute]
91+ , complexModelGroup :: Maybe ModelGroup
92+ , complexAnnotations :: [Annotation]
93+ }
94+ deriving (Show, Eq)
95+
96+data ModelGroup
97+ = Sequence [Element]
98+ | Choice [Element]
99+ | All [Element]
100+ deriving (Show, Eq)
101+
102+data Attribute = Attribute
103+ { attrName :: QName
104+ , attrType :: RefOr SimpleType
105+ , attrUse :: Use
106+ }
107+ deriving (Show, Eq)
108+
109+data Use
110+ = Optional
111+ | Prohibited
112+ | Required
113+ deriving (Show, Eq)
114+
115+data Restriction = Restriction
116+ { restrictionBase :: RefOr SimpleType
117+ , restrictionConstraints :: [Constraint]
118+ }
119+ deriving (Show, Eq)
120+
121+-- | Reference to a type or an inline one
122+data RefOr t
123+ = Ref QName
124+ | Inline t
125+ deriving (Show, Eq)
126+
127+data Constraint
128+ = Enumeration Text
129+ deriving (Show, Eq)
130+
131+data QName = QName
132+ { qnNamespace :: Maybe Namespace
133+ , qnName :: Text
134+ }
135+ deriving (Show, Eq, Ord)
136+
137+-- | XMLSchema namespace, all relevant xml nodes should live in it
138+schemaNamespace :: Text
139+schemaNamespace = "http://www.w3.org/2001/XMLSchema"
test/Main.hs+2−16
@@ -1,23 +1,9 @@
1−{-# OPTIONS -fno-warn-unused-imports #-}
21module Main where
32
4−import Control.Exception
5−import Data.ByteString.Lazy as BL
6−import Data.Either
73import Test.Hspec
8−import Text.XML
9−import Text.XSD
104
5+import Spec (spec)
116
127main :: IO ()
138main = hspec $ do
14− it "parses simple xsd correctly" $ do
15− xsd <- parseXSD def <$> BL.readFile "test/fixtures/simple.xsd"
16− xsd `shouldSatisfy` isRight
17− it "parses retrieve_set_map xsd correctly" $ do
18− xsd <- parseXSD def <$> BL.readFile "test/fixtures/retrieve_seat_map.xml"
19− xsd `shouldSatisfy` isRight
20− -- complexContent, imports and extensions are unsupported
21− -- it "parses enhanced_air_ticket xsd correctly" $ do
22− -- xsd <- parseXSD def <$> BL.readFile "test/fixtures/enhanced_air_ticket.xsd"
23− -- xsd `shouldSatisfy` isRight
9+ spec
test/Spec.hsnew file+261
@@ -0,0 +1,261 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Spec
4+( spec
5+)
6+where
7+
8+import Data.Text (Text)
9+import Data.Either
10+import Data.Map (Map)
11+import qualified Data.Map as Map
12+import Text.XML
13+
14+import qualified Xsd
15+
16+import Test.Hspec
17+
18+spec :: Spec
19+spec = do
20+ describe "parse" $ do
21+ context "when targetNamespace is given" $ do
22+ it "parses the namespace" $ do
23+ let
24+ doc = mkDoc $
25+ mkElem "schema"
26+ (Map.fromList[("targetNamespace", "something")])
27+ []
28+ Right xsd = Xsd.parse Xsd.defaultConfig doc
29+ Xsd.targetNamespace xsd `shouldBe` Just (Xsd.Namespace "something")
30+
31+ context "when targetNamespace is not given" $ do
32+ it "returns Nothing" $ do
33+ let
34+ doc = mkDoc $
35+ mkElem "schema"
36+ (Map.fromList [])
37+ []
38+ Right xsd = Xsd.parse Xsd.defaultConfig doc
39+ Xsd.targetNamespace xsd `shouldBe` Nothing
40+
41+ context "when root element is not schema" $ do
42+ context "when root element has different name" $ do
43+ it "fails" $ do
44+ let
45+ doc = mkDoc $
46+ mkElem "notschema"
47+ (Map.fromList [])
48+ []
49+ Left err = Xsd.parse Xsd.defaultConfig doc
50+ Xsd.errorLocation err `shouldBe` "notschema"
51+
52+ context "when root element has different namespace" $ do
53+ it "fails" $ do
54+ let
55+ doc = mkDoc $
56+ Element "{othernamespace}schema"
57+ (Map.fromList [])
58+ []
59+ Left err = Xsd.parse Xsd.defaultConfig doc
60+ Xsd.errorLocation err `shouldBe` "schema"
61+
62+ context "when ignoring schema namespace" $ do
63+ it "succeeds" $ do
64+ let
65+ doc = mkDoc $
66+ Element "{othernamespace}schema"
67+ (Map.fromList [])
68+ []
69+ res = Xsd.parse conf doc
70+ conf = Xsd.defaultConfig
71+ { Xsd.configIgnoreSchemaNamespace = True
72+ }
73+ res `shouldSatisfy` isRight
74+
75+ context "when simple type is given" $ do
76+ context "when it's atomic with restriction" $ do
77+ it "parses it" $ do
78+ let
79+ doc = mkDoc $
80+ mkElem "schema"
81+ (Map.fromList [("xmlns:xs","something")])
82+ [NodeElement $ mkElem "simpleType"
83+ (Map.fromList [("name", "str")])
84+ [NodeElement $ mkElem "restriction"
85+ (Map.fromList [("base", "xs:string")])
86+ []]]
87+ res = Xsd.parse Xsd.defaultConfig doc
88+ Right [Xsd.ChildType tpName (Xsd.TypeSimple t)] =
89+ fmap Xsd.children res
90+ Xsd.AtomicType restriction _ = t
91+ res `shouldSatisfy` isRight
92+ tpName `shouldBe` (Xsd.QName Nothing "str")
93+ Xsd.restrictionBase restriction `shouldBe`
94+ Xsd.Ref (Xsd.QName (Just (Xsd.Namespace "something")) "string")
95+
96+ context "when restrication base is inlined" $ do
97+ it "parses it" $ do
98+ let
99+ doc = mkDoc $
100+ mkElem "schema"
101+ (Map.fromList [("xmlns:xs","something")])
102+ [NodeElement $ mkElem "simpleType"
103+ (Map.fromList [("name", "str")])
104+ [NodeElement $ mkElem "restriction" Map.empty
105+ [NodeElement $ mkElem "simpleType" Map.empty
106+ [NodeElement $ mkElem "restriction"
107+ (Map.fromList [("base", "xs:string")])
108+ []]]]]
109+ res = Xsd.parse Xsd.defaultConfig doc
110+ Right [Xsd.ChildType tpName (Xsd.TypeSimple t)] =
111+ fmap Xsd.children res
112+ Xsd.AtomicType restriction' _ = t
113+ Xsd.Inline (Xsd.AtomicType restriction _) =
114+ Xsd.restrictionBase restriction'
115+ res `shouldSatisfy` isRight
116+ tpName `shouldBe` (Xsd.QName Nothing "str")
117+ Xsd.restrictionBase restriction `shouldBe`
118+ Xsd.Ref (Xsd.QName (Just (Xsd.Namespace "something")) "string")
119+
120+ context "when base is refers to an unbound prefix" $ do
121+ it "fails" $ do
122+ let
123+ doc = mkDoc $
124+ mkElem "schema"
125+ (Map.fromList [])
126+ [NodeElement $ mkElem "simpleType"
127+ (Map.fromList [("name", "str")])
128+ [NodeElement $ mkElem "restriction"
129+ (Map.fromList [("base", "xs:string")])
130+ []]]
131+ res = Xsd.parse Xsd.defaultConfig doc
132+ Left err = res
133+ res `shouldSatisfy` isLeft
134+ Xsd.errorLocation err `shouldBe`
135+ "schema.simpleType[str].restriction"
136+
137+ context "when target namespace is provided" $ do
138+ it "parses it" $ do
139+ let
140+ doc = mkDoc $
141+ mkElem "schema"
142+ (Map.fromList
143+ [ ("xmlns:xs","something")
144+ , ("targetNamespace", "me")
145+ ])
146+ [NodeElement $ mkElem "simpleType"
147+ (Map.fromList [("name", "str")])
148+ [NodeElement $ mkElem "restriction"
149+ (Map.fromList [("base", "xs:string")])
150+ []]]
151+ res = Xsd.parse Xsd.defaultConfig doc
152+ Right [Xsd.ChildType tpName _] = fmap Xsd.children res
153+ res `shouldSatisfy` isRight
154+ tpName `shouldBe` (Xsd.QName (Just (Xsd.Namespace "me")) "str")
155+
156+ context "when complex type is given" $ do
157+ context "when it has attributes" $ do
158+ context "when attribute type is a reference" $ do
159+ it "succeeds" $ do
160+ let
161+ doc = mkDoc $
162+ mkElem "schema"
163+ (Map.fromList [("xmlns:xs","something")])
164+ [NodeElement $ mkElem "complexType"
165+ (Map.fromList [("name", "person")])
166+ [NodeElement $ mkElem "attribute"
167+ (Map.fromList
168+ [ ("type", "xs:string")
169+ , ("name", "firstName")
170+ ])
171+ []]]
172+ res = Xsd.parse Xsd.defaultConfig doc
173+ Right [Xsd.ChildType tpName (Xsd.TypeComplex t)] =
174+ fmap Xsd.children res
175+ [attr] = Xsd.complexAttributes t
176+ res `shouldSatisfy` isRight
177+ tpName `shouldBe` Xsd.QName Nothing "person"
178+ Xsd.attrName attr `shouldBe` Xsd.QName Nothing "firstName"
179+ Xsd.attrType attr `shouldBe`
180+ Xsd.Ref (Xsd.QName (Just (Xsd.Namespace "something")) "string")
181+
182+ context "when attribute type is inlined" $ do
183+ it "succeeds" $ do
184+ let
185+ doc = mkDoc $
186+ mkElem "schema"
187+ (Map.fromList [("xmlns:xs","something")])
188+ [NodeElement $ mkElem "complexType"
189+ (Map.fromList [("name", "person")])
190+ [NodeElement $ mkElem "attribute"
191+ (Map.fromList [("name", "firstName")])
192+ [NodeElement $ mkElem "simpleType"
193+ (Map.empty)
194+ [NodeElement $ mkElem "restriction"
195+ (Map.fromList [("base", "xs:string")])
196+ []]]]]
197+ res = Xsd.parse Xsd.defaultConfig doc
198+ Right [Xsd.ChildType _ (Xsd.TypeComplex t)] =
199+ fmap Xsd.children res
200+ [attr] = Xsd.complexAttributes t
201+ Xsd.Inline (Xsd.AtomicType restriction _) = Xsd.attrType attr
202+ res `shouldSatisfy` isRight
203+ Xsd.restrictionBase restriction `shouldBe`
204+ Xsd.Ref (Xsd.QName (Just (Xsd.Namespace "something")) "string")
205+
206+ context "when it contains a sequence" $ do
207+ it "succeeds" $ do
208+ let
209+ doc = mkDoc $
210+ mkElem "schema"
211+ (Map.fromList [("xmlns:xs","something")])
212+ [NodeElement $ mkElem "complexType"
213+ (Map.fromList [("name", "person")])
214+ [NodeElement $ mkElem "sequence" Map.empty
215+ [ NodeElement $ mkElem "element"
216+ (Map.fromList
217+ [ ("name", "firstName")
218+ , ("type", "xs:string")
219+ ])
220+ []
221+ , NodeElement $ mkElem "element"
222+ (Map.fromList
223+ [ ("name", "lastName")
224+ , ("type", "xs:string")
225+ ])
226+ []
227+ ]]]
228+ res = Xsd.parse Xsd.defaultConfig doc
229+ Right [Xsd.ChildType _ (Xsd.TypeComplex t)] =
230+ fmap Xsd.children res
231+ Just (Xsd.Sequence elems) = Xsd.complexModelGroup t
232+ res `shouldSatisfy` isRight
233+ map Xsd.elementName elems `shouldBe`
234+ map (Xsd.QName Nothing) ["firstName", "lastName"]
235+
236+ context "when element is given" $ do
237+ context "when type is inlined" $ do
238+ it "succeeds" $ do
239+ let
240+ doc = mkDoc $
241+ mkElem "schema"
242+ (Map.fromList [("xmlns:xs","something")])
243+ [NodeElement $ mkElem "element"
244+ (Map.fromList [("name", "person")])
245+ [NodeElement $ mkElem "simpleType" Map.empty
246+ [NodeElement $ mkElem "restriction"
247+ (Map.fromList [("base", "xs:string")])
248+ []]
249+ ]
250+ ]
251+ res = Xsd.parse Xsd.defaultConfig doc
252+ Right [Xsd.ChildElement e] = fmap Xsd.children res
253+ res `shouldSatisfy` isRight
254+ Xsd.elementName e `shouldBe`
255+ Xsd.QName Nothing "person"
256+
257+mkDoc :: Element -> Document
258+mkDoc e = Document (Prologue [] Nothing []) e []
259+
260+mkElem :: Text -> Map Name Text -> [Node] -> Element
261+mkElem n = Element (Name n (Just Xsd.schemaNamespace) Nothing)
test/fixtures/enhanced_air_ticket.xsddeleted−1702
@@ -1,1702 +0,0 @@
1−<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:spct="http://services.sabre.com/sp/common/simple/v3" xmlns:stlp="http://services.sabre.com/STL_Payload/v02_01" xmlns:ns1="http://services.sabre.com/sp/air/ticket/v1" targetNamespace="http://services.sabre.com/sp/air/ticket/v1" elementFormDefault="qualified">
2− <import namespace="http://services.sabre.com/STL_Payload/v02_01" schemaLocation="built-ins/STL2_Payload_v02_01.xsd"/>
3− <import namespace="http://services.sabre.com/sp/common/simple/v3" schemaLocation="SpCommonSimpleTypes_v3.xsd"/>
4− <element name="AirTicketRQ">
5− <complexType>
6− <complexContent>
7− <extension base="stlp:STL_Request_Payload">
8− <sequence>
9− <element name="DesignatePrinter" minOccurs="0">
10− <complexType>
11− <sequence>
12− <element name="Printers" minOccurs="0">
13− <complexType>
14− <sequence>
15− <element name="BagTag" minOccurs="0">
16− <complexType>
17− <attribute name="LNIATA" type="string" use="optional">
18− <annotation>
19− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
20− </annotation>
21− </attribute>
22− </complexType>
23− </element>
24− <element name="BoardingPass" minOccurs="0">
25− <complexType>
26− <attribute name="HostedCarrier" type="boolean" use="optional">
27− <annotation>
28− <documentation>"HostedCarrier" is used by airline customers to indicate that this request is for an airline-based boarding pass printer.</documentation>
29− </annotation>
30− </attribute>
31− <attribute name="LNIATA" type="string" use="optional">
32− <annotation>
33− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
34− </annotation>
35− </attribute>
36− </complexType>
37− </element>
38− <element name="Hardcopy" minOccurs="0">
39− <complexType>
40− <attribute name="Spacing" use="optional">
41− <annotation>
42− <documentation>"Spacing" is used to specify the spacing, either 1, or 2.</documentation>
43− </annotation>
44− <simpleType>
45− <restriction base="string">
46− <enumeration value="1"/>
47− <enumeration value="2"/>
48− </restriction>
49− </simpleType>
50− </attribute>
51− <attribute name="LNIATA" type="string" use="optional">
52− <annotation>
53− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
54− </annotation>
55− </attribute>
56− </complexType>
57− </element>
58− <element name="InvoiceItinerary" minOccurs="0">
59− <complexType>
60− <attribute name="LNIATA" type="string" use="optional">
61− <annotation>
62− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
63− </annotation>
64− </attribute>
65− </complexType>
66− </element>
67− <element name="ListLabel" minOccurs="0">
68− <complexType>
69− <attribute name="LNIATA" type="string" use="optional">
70− <annotation>
71− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
72− </annotation>
73− </attribute>
74− </complexType>
75− </element>
76− <element name="MiniItinerary" minOccurs="0">
77− <complexType>
78− <attribute name="LNIATA" type="string" use="optional">
79− <annotation>
80− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
81− </annotation>
82− </attribute>
83− </complexType>
84− </element>
85− <element name="Report" minOccurs="0">
86− <complexType>
87− <attribute name="LNIATA" type="string" use="optional">
88− <annotation>
89− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
90− </annotation>
91− </attribute>
92− </complexType>
93− </element>
94− <element name="Ticket" minOccurs="0">
95− <complexType>
96− <sequence>
97− <element name="MiniItinerary" minOccurs="0">
98− <complexType>
99− <attribute name="LNIATA" type="string" use="optional">
100− <annotation>
101− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
102− </annotation>
103− </attribute>
104− </complexType>
105− </element>
106− <element name="Remote" minOccurs="0">
107− <complexType>
108− <attribute name="LNIATA" type="string" use="optional">
109− <annotation>
110− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
111− </annotation>
112− </attribute>
113− </complexType>
114− </element>
115− </sequence>
116− <attribute name="CountryCode" type="string" use="optional"/>
117− <attribute name="LNIATA" type="string" use="optional">
118− <annotation>
119− <documentation>"LNIATA" is used to specify a bag tag printer address.</documentation>
120− </annotation>
121− </attribute>
122− </complexType>
123− </element>
124− </sequence>
125− </complexType>
126− </element>
127− <element name="Profile" minOccurs="0">
128− <complexType>
129− <attribute name="Number" type="integer" use="optional">
130− <annotation>
131− <documentation>"Number" is used to specify a previously established printer number.</documentation>
132− </annotation>
133− </attribute>
134− </complexType>
135− </element>
136− </sequence>
137− </complexType>
138− </element>
139− <element name="Itinerary" minOccurs="1">
140− <complexType>
141− <attribute name="ID" use="required">
142− <annotation>
143− <documentation>"ID" is used to specify a record locator.</documentation>
144− </annotation>
145− <simpleType>
146− <restriction base="string"/>
147− </simpleType>
148− </attribute>
149− </complexType>
150− </element>
151− <element name="AccountingLines" minOccurs="0">
152− <complexType>
153− <sequence>
154− <element name="Delete" minOccurs="0" maxOccurs="unbounded">
155− <complexType>
156− <attribute name="EndNumber" type="integer" use="optional">
157− <annotation>
158− <documentation>"EndNumber" when used with @Number to specify a range of accounting lines to delete.</documentation>
159− </annotation>
160− </attribute>
161− <attribute name="Number" type="integer" use="required">
162− <annotation>
163− <documentation>"Number" is used to specify particular accounting lines.</documentation>
164− </annotation>
165− </attribute>
166− </complexType>
167− </element>
168− </sequence>
169− <attribute name="All" type="boolean" use="optional">
170− <annotation>
171− <documentation>"All" is used to delete all accounting lines, cannot combine with attribute None.</documentation>
172− </annotation>
173− </attribute>
174− <attribute name="None" type="boolean" use="optional">
175− <annotation>
176− <documentation>"None" is used to indicate not to delete any of the accounting lines, cannot combine with "All" attribute.</documentation>
177− </annotation>
178− </attribute>
179− </complexType>
180− </element>
181− <element name="Ticketing" minOccurs="1" maxOccurs="99">
182− <complexType>
183− <sequence>
184− <element name="FlightQualifiers" minOccurs="0">
185− <complexType>
186− <sequence>
187− <element name="VendorPrefs" minOccurs="0">
188− <complexType>
189− <sequence>
190− <element name="Airline">
191− <complexType>
192− <attribute name="Code" type="string" use="required">
193− <annotation>
194− <documentation>"Code" is used to specify a particular vendor code.</documentation>
195− </annotation>
196− </attribute>
197− </complexType>
198− </element>
199− </sequence>
200− </complexType>
201− </element>
202− </sequence>
203− </complexType>
204− </element>
205− <element name="FOP_Qualifiers" minOccurs="0">
206− <complexType>
207− <sequence>
208− <element name="BasicFOP" minOccurs="0">
209− <annotation>
210− <documentation>BasicFOP cannot combine with .../BSP_Ticketing, or .../SabreSonicTicketing, or .../Multiple CC_FOP.</documentation>
211− </annotation>
212− <complexType>
213− <sequence>
214− <element name="CC_Info" minOccurs="0">
215− <complexType>
216− <sequence>
217− <element name="PaymentCard">
218− <complexType>
219− <attribute name="Code" type="string" use="optional">
220− <annotation>
221− <documentation>"Code" is used to specify a credit card vendor code.</documentation>
222− </annotation>
223− </attribute>
224− <attribute name="CardSecurityCode" type="string" use="optional">
225− <annotation>
226− <documentation>"CardSecurityCode" is used to specify a credit card Card Security Code number.</documentation>
227− </annotation>
228− </attribute>
229− <attribute name="ExpireDate" type="spct:expireDate" use="optional">
230− <annotation>
231− <documentation>"ExpireDate" is used to specify a credit card expiration date, follows this format: YYYY-MM.</documentation>
232− </annotation>
233− </attribute>
234− <attribute name="ExtendedPayment" type="integer" use="optional">
235− <annotation>
236− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
237− </annotation>
238− </attribute>
239− <attribute name="ManualApprovalCode" type="string" use="optional">
240− <annotation>
241− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
242− </annotation>
243− </attribute>
244− <attribute name="Number" type="integer" use="optional">
245− <annotation>
246− <documentation>"Number" is used to specify a credit card number.</documentation>
247− </annotation>
248− </attribute>
249− </complexType>
250− </element>
251− </sequence>
252− <attribute name="Suppress" type="boolean" use="optional">
253− <annotation>
254− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
255− </annotation>
256− </attribute>
257− </complexType>
258− </element>
259− </sequence>
260− <attribute name="Reference" type="integer" use="optional"/>
261− <attribute name="Type" type="string" use="optional">
262− <annotation>
263− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA," (cash) "CK," (check) "CQ," (cheque). If utilizing a credit card please omit @Type, and populate the .../CC_Info child node.</documentation>
264− </annotation>
265− </attribute>
266− <attribute name="Virtual" type="string" use="optional"/>
267− </complexType>
268− </element>
269− <element name="BSP_Ticketing" minOccurs="0">
270− <complexType>
271− <sequence>
272− <element name="MultipleFOP" minOccurs="0">
273− <annotation>
274− <documentation>MultipleFOP cannot combine with .../MultipleMiscFOP, or .../PayLaterPlan</documentation>
275− </annotation>
276− <complexType>
277− <sequence>
278− <element name="Fare">
279− <complexType>
280− <attribute name="Amount" type="string" use="required">
281− <annotation>
282− <documentation>"Amount" is used to specify the amount to be applied to the second FOP.</documentation>
283− </annotation>
284− </attribute>
285− </complexType>
286− </element>
287− <element name="FOP_One">
288− <complexType>
289− <sequence>
290− <element name="CC_Info" minOccurs="0">
291− <complexType>
292− <sequence>
293− <element name="PaymentCard">
294− <complexType>
295− <attribute name="Code" type="string" use="required">
296− <annotation>
297− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
298− </annotation>
299− </attribute>
300− <attribute name="CardSecurityCode" type="string" use="optional">
301− <annotation>
302− <documentation>"CardSecurityCode" is used to specify a credit card Card Security Code number.</documentation>
303− </annotation>
304− </attribute>
305− <attribute name="ExpireDate" type="spct:expireDate" use="required">
306− <annotation>
307− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM.</documentation>
308− </annotation>
309− </attribute>
310− <attribute name="ExtendedPayment" type="integer" use="optional">
311− <annotation>
312− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
313− </annotation>
314− </attribute>
315− <attribute name="ManualApprovalCode" type="string" use="optional">
316− <annotation>
317− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
318− </annotation>
319− </attribute>
320− <attribute name="ManualOBFee" type="string" use="optional">
321− <annotation>
322− <documentation>"ManualOBFee" is used to indicate that the manual OB fee should be associated to the card. A manual OB fee can ONLY be added to a ticketing entry that references a PQ that has the PRICE-MANUAL tag at the bottom of the *PQ</documentation>
323− </annotation>
324− </attribute>
325− <attribute name="Number" type="integer" use="required">
326− <annotation>
327− <documentation>"Number" is used to specify the credit card number.</documentation>
328− </annotation>
329− </attribute>
330− </complexType>
331− </element>
332− </sequence>
333− <attribute name="Suppress" type="boolean" use="optional">
334− <annotation>
335− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
336− </annotation>
337− </attribute>
338− </complexType>
339− </element>
340− </sequence>
341− <attribute name="Type" type="string" use="optional">
342− <annotation>
343− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA,"CK," or "CQ." If utilizing a credit card please omit @Type, and populate the .../CC_Info child node.</documentation>
344− </annotation>
345− </attribute>
346− </complexType>
347− </element>
348− <element name="FOP_Two">
349− <complexType>
350− <sequence>
351− <element name="CC_Info" minOccurs="0">
352− <complexType>
353− <sequence>
354− <element name="PaymentCard">
355− <complexType>
356− <attribute name="Code" type="string" use="required">
357− <annotation>
358− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
359− </annotation>
360− </attribute>
361− <attribute name="CardSecurityCode" type="string" use="optional">
362− <annotation>
363− <documentation>"CardSecurityCode" is used to specify a credit card Card Security Code number.</documentation>
364− </annotation>
365− </attribute>
366− <attribute name="ExpireDate" type="spct:expireDate" use="required">
367− <annotation>
368− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM.</documentation>
369− </annotation>
370− </attribute>
371− <attribute name="ExtendedPayment" type="integer" use="optional">
372− <annotation>
373− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
374− </annotation>
375− </attribute>
376− <attribute name="ManualApprovalCode" type="string" use="optional">
377− <annotation>
378− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
379− </annotation>
380− </attribute>
381− <attribute name="ManualOBFee" type="string" use="optional">
382− <annotation>
383− <documentation>b"ManualOBFee" is used to indicate that the manual OB fee should be associated to the card. A manual OB fee can ONLY be added to a ticketing entry that references a PQ that has the PRICE-MANUAL tag at the bottom of the *PQ</documentation>
384− </annotation>
385− </attribute>
386− <attribute name="Number" type="integer" use="required">
387− <annotation>
388− <documentation>"Number" is used to specify the credit card number.</documentation>
389− </annotation>
390− </attribute>
391− </complexType>
392− </element>
393− </sequence>
394− <attribute name="Suppress" type="boolean" use="optional">
395− <annotation>
396− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
397− </annotation>
398− </attribute>
399− </complexType>
400− </element>
401− </sequence>
402− <attribute name="Type" type="string" use="optional">
403− <annotation>
404− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA,"CK," or "CQ." If utilizing a credit card please omit @Type, and populate the .../CC_Info child node.</documentation>
405− </annotation>
406− </attribute>
407− </complexType>
408− </element>
409− <element name="Taxes" minOccurs="0">
410− <complexType>
411− <sequence>
412− <element name="Tax" maxOccurs="3">
413− <complexType>
414− <attribute name="Amount" type="string" use="required">
415− <annotation>
416− <documentation>"Amount" is used to specify the tax amount.</documentation>
417− </annotation>
418− </attribute>
419− <attribute name="TaxCode" type="string" use="required">
420− <annotation>
421− <documentation>"TaxCode" is used to specify the tax code.</documentation>
422− </annotation>
423− </attribute>
424− </complexType>
425− </element>
426− </sequence>
427− </complexType>
428− </element>
429− </sequence>
430− </complexType>
431− </element>
432− <element name="MultipleMiscFOP" minOccurs="0">
433− <annotation>
434− <documentation>MultipleMiscFOP cannot combine with .../MultipleFOP, or .../PayLaterPlan.</documentation>
435− </annotation>
436− <complexType>
437− <sequence>
438− <element name="Fare">
439− <complexType>
440− <attribute name="Amount" type="string" use="required">
441− <annotation>
442− <documentation>"Amount" is used to specify the fare amount to be applied to the second FOP.</documentation>
443− </annotation>
444− </attribute>
445− </complexType>
446− </element>
447− <element name="FOP_One">
448− <complexType>
449− <sequence>
450− <element name="CC_Info" minOccurs="0">
451− <complexType>
452− <sequence>
453− <element name="PaymentCard">
454− <complexType>
455− <attribute name="Code" type="string" use="required">
456− <annotation>
457− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
458− </annotation>
459− </attribute>
460− <attribute name="ExpireDate" type="spct:expireDate" use="required">
461− <annotation>
462− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM.</documentation>
463− </annotation>
464− </attribute>
465− <attribute name="ExtendedPayment" type="integer" use="optional">
466− <annotation>
467− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
468− </annotation>
469− </attribute>
470− <attribute name="ManualApprovalCode" type="string" use="optional">
471− <annotation>
472− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
473− </annotation>
474− </attribute>
475− <attribute name="Number" type="integer" use="required">
476− <annotation>
477− <documentation>"Number" is used to specify the credit card number.</documentation>
478− </annotation>
479− </attribute>
480− </complexType>
481− </element>
482− </sequence>
483− <attribute name="Suppress" type="boolean" use="optional">
484− <annotation>
485− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
486− </annotation>
487− </attribute>
488− </complexType>
489− </element>
490− </sequence>
491− <attribute name="Type" type="string" use="optional">
492− <annotation>
493− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA,"CK," or "CQ." If utilizing a credit card please omit @Type, and populate the .../CC_Info child node.</documentation>
494− </annotation>
495− </attribute>
496− </complexType>
497− </element>
498− <element name="FOP_Two">
499− <complexType>
500− <sequence>
501− <element name="ExtendedPayment" minOccurs="0">
502− <complexType>
503− <attribute name="NumMonths" type="integer" use="required"/>
504− </complexType>
505− </element>
506− </sequence>
507− <attribute name="Type" type="string" use="required"/>
508− </complexType>
509− </element>
510− <element name="Taxes" minOccurs="0">
511− <complexType>
512− <sequence>
513− <element name="Tax" maxOccurs="2">
514− <complexType>
515− <attribute name="Amount" type="string" use="required">
516− <annotation>
517− <documentation>"Amount" is used to specify the tax amount.</documentation>
518− </annotation>
519− </attribute>
520− <attribute name="TaxCode" type="string" use="required">
521− <annotation>
522− <documentation>"TaxCode" is used to specify the tax code.</documentation>
523− </annotation>
524− </attribute>
525− </complexType>
526− </element>
527− </sequence>
528− </complexType>
529− </element>
530− </sequence>
531− </complexType>
532− </element>
533− <element name="PayLaterPlan" minOccurs="0">
534− <annotation>
535− <documentation>"PayLaterPlan" is only applicable to Brazil, cannot combine with MultipleFOP, or MultipleMiscFOP.</documentation>
536− </annotation>
537− <complexType>
538− <sequence>
539− <element name="Fare">
540− <complexType>
541− <attribute name="Amount" type="string" use="required">
542− <annotation>
543− <documentation>"Amount" is used to specify the remaining fare amount.</documentation>
544− </annotation>
545− </attribute>
546− </complexType>
547− </element>
548− <element name="FOP">
549− <complexType>
550− <sequence>
551− <element name="CC_Info" minOccurs="0">
552− <complexType>
553− <sequence>
554− <element name="PaymentCard">
555− <complexType>
556− <attribute name="Code" type="string" use="required">
557− <annotation>
558− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
559− </annotation>
560− </attribute>
561− <attribute name="ExpireDate" type="spct:expireDate" use="required">
562− <annotation>
563− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM</documentation>
564− </annotation>
565− </attribute>
566− <attribute name="ManualApprovalCode" type="string" use="optional">
567− <annotation>
568− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
569− </annotation>
570− </attribute>
571− <attribute name="Number" type="integer" use="required">
572− <annotation>
573− <documentation>"Number" is used to specify the credit card number.</documentation>
574− </annotation>
575− </attribute>
576− </complexType>
577− </element>
578− </sequence>
579− </complexType>
580− </element>
581− </sequence>
582− <attribute name="Type" type="string" use="optional">
583− <annotation>
584− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA,"CK," or "CQ." If utilizing a credit card please omit @Type, and populate the .../CC_Info child node.</documentation>
585− </annotation>
586− </attribute>
587− </complexType>
588− </element>
589− <element name="Installment">
590− <complexType>
591− <attribute name="Count" type="string" use="required">
592− <annotation>
593− <documentation>"Count" is used to specify the number of installments.</documentation>
594− </annotation>
595− </attribute>
596− <attribute name="PayLaterReferenceNumber" type="string" use="required">
597− <annotation>
598− <documentation>"PayLaterReferenceNumber" is used to specify the pay later reference number.</documentation>
599− </annotation>
600− </attribute>
601− <attribute name="Value" type="string" use="required">
602− <annotation>
603− <documentation>"Value" is used to specify the value of the installments. Please note that decimals are not permitted.</documentation>
604− </annotation>
605− </attribute>
606− </complexType>
607− </element>
608− </sequence>
609− </complexType>
610− </element>
611− </sequence>
612− </complexType>
613− </element>
614− <element name="MultipleCC_FOP" minOccurs="0">
615− <annotation>
616− <documentation>Multiple CC_FOP cannot combine with .../BSP_Ticketing, or .../SabreSonicTicketing</documentation>
617− </annotation>
618− <complexType>
619− <sequence>
620− <element name="Fare">
621− <complexType>
622− <attribute name="Amount" type="string" use="required">
623− <annotation>
624− <documentation>"Amount" is used to specify the amount to be applied to the second CC.</documentation>
625− </annotation>
626− </attribute>
627− </complexType>
628− </element>
629− <element name="CC_One">
630− <complexType>
631− <sequence>
632− <element name="CC_Info" minOccurs="0">
633− <complexType>
634− <sequence>
635− <element name="PaymentCard">
636− <complexType>
637− <attribute name="Code" type="string" use="required">
638− <annotation>
639− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
640− </annotation>
641− </attribute>
642− <attribute name="CardSecurityCode" type="string" use="optional">
643− <annotation>
644− <documentation>"CardSecurityCode" is used to specify a credit card Card Security Code number.</documentation>
645− </annotation>
646− </attribute>
647− <attribute name="ExpireDate" type="spct:expireDate" use="required">
648− <annotation>
649− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM</documentation>
650− </annotation>
651− </attribute>
652− <attribute name="ExtendedPayment" type="integer" use="optional">
653− <annotation>
654− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
655− </annotation>
656− </attribute>
657− <attribute name="ManualApprovalCode" type="string" use="optional">
658− <annotation>
659− <documentation>"ManualApprovalCode" is used to specify a manual credit card if applicable.</documentation>
660− </annotation>
661− </attribute>
662− <attribute name="ManualOBFee" type="string" use="optional">
663− <annotation>
664− <documentation>"ManualOBFee" is used to indicate that the manual OB fee should be associated to the card. A manual OB fee can ONLY be added to a ticketing entry that references a PQ that has the PRICE-MANUAL tag at the bottom of the *PQ</documentation>
665− </annotation>
666− </attribute>
667− <attribute name="Number" type="integer" use="required">
668− <annotation>
669− <documentation>"Number" is used to specify the credit card number.</documentation>
670− </annotation>
671− </attribute>
672− </complexType>
673− </element>
674− </sequence>
675− <attribute name="Suppress" type="boolean" use="optional">
676− <annotation>
677− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
678− </annotation>
679− </attribute>
680− </complexType>
681− </element>
682− </sequence>
683− </complexType>
684− </element>
685− <element name="CC_Two">
686− <complexType>
687− <sequence>
688− <element name="CC_Info" minOccurs="0">
689− <complexType>
690− <sequence>
691− <element name="PaymentCard">
692− <complexType>
693− <attribute name="Code" type="string" use="required">
694− <annotation>
695− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
696− </annotation>
697− </attribute>
698− <attribute name="CardSecurityCode" type="string" use="optional">
699− <annotation>
700− <documentation>"CardSecurityCode" is used to specify a credit card Card Security Code number.</documentation>
701− </annotation>
702− </attribute>
703− <attribute name="ExpireDate" type="spct:expireDate" use="required">
704− <annotation>
705− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM</documentation>
706− </annotation>
707− </attribute>
708− <attribute name="ExtendedPayment" type="integer" use="optional">
709− <annotation>
710− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
711− </annotation>
712− </attribute>
713− <attribute name="ManualApprovalCode" type="string" use="optional">
714− <annotation>
715− <documentation>"ManualApprovalCode" is used to specify a manual credit card if applicable.</documentation>
716− </annotation>
717− </attribute>
718− <attribute name="ManualOBFee" type="string" use="optional">
719− <annotation>
720− <documentation>"ManualOBFee" is used to indicate that the manual OB fee should be associated to the card. A manual OB fee can ONLY be added to a ticketing entry that references a PQ that has the 'PRICE-MANUAL' tag at the bottom of the *PQ</documentation>
721− </annotation>
722− </attribute>
723− <attribute name="Number" type="integer" use="required">
724− <annotation>
725− <documentation>"Number" is used to specify the credit card number.</documentation>
726− </annotation>
727− </attribute>
728− </complexType>
729− </element>
730− </sequence>
731− <attribute name="Suppress" type="boolean" use="optional">
732− <annotation>
733− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
734− </annotation>
735− </attribute>
736− </complexType>
737− </element>
738− </sequence>
739− </complexType>
740− </element>
741− </sequence>
742− </complexType>
743− </element>
744− <element name="SabreSonicTicketing" minOccurs="0">
745− <annotation>
746− <documentation>"SabreSonicTicketing" is only valid for SabreSonic-based airlines, cannot combine with .../BSP_Ticketing, or .../Multiple CC_FOP.</documentation>
747− </annotation>
748− <complexType>
749− <sequence>
750− <element name="BasicFOP" minOccurs="0">
751− <complexType>
752− <sequence>
753− <element name="CC_Info" minOccurs="0">
754− <complexType>
755− <sequence>
756− <element name="PaymentCard">
757− <complexType>
758− <attribute name="CardSecurityCode" type="integer" use="optional">
759− <annotation>
760− <documentation>"CardSecurityCode" is used to specify a credit card security code.</documentation>
761− </annotation>
762− </attribute>
763− <attribute name="Code" type="string" use="required">
764− <annotation>
765− <documentation>"Code" is used to specify a credit card vendor code.</documentation>
766− </annotation>
767− </attribute>
768− <attribute name="ExpireDate" type="spct:expireDate" use="required">
769− <annotation>
770− <documentation>"ExpireDate" is used to specify a credit card expiration date, follows this format: YYYY-MM.</documentation>
771− </annotation>
772− </attribute>
773− <attribute name="ExtendedPayment" type="integer" use="optional">
774− <annotation>
775− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
776− </annotation>
777− </attribute>
778− <attribute name="ManualApprovalCode" type="string" use="optional">
779− <annotation>
780− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
781− </annotation>
782− </attribute>
783− <attribute name="Number" type="integer" use="required">
784− <annotation>
785− <documentation>"Number" is used to specify a credit card number.</documentation>
786− </annotation>
787− </attribute>
788− </complexType>
789− </element>
790− </sequence>
791− <attribute name="Suppress" type="boolean" use="optional">
792− <annotation>
793− <documentation>"Suppress" is used to specify whether or not to suppress credit card information on an itinerary.</documentation>
794− </annotation>
795− </attribute>
796− </complexType>
797− </element>
798− </sequence>
799− <attribute name="ManualApprovalCode" type="string" use="optional">
800− <annotation>
801− <documentation>"ManualApprovalCode" is used to specify a manual approval code for non-credit card forms of payment.</documentation>
802− </annotation>
803− </attribute>
804− <attribute name="Type" type="string" use="optional">
805− <annotation>
806− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA," (cash) "CK," (check) "CQ," (cheque) "PT," "PTACA," (PTA cash) "PTAGTCK." (PTA agency check) or "PTCK" (PTA check). If utilizing a credit card please omit @Type, and populate the .../CC_Info child node, unless needing to specify a PTA credit card form of payment. For a PTA credit card form of payment the client should pass Type="PT" and populate the .../CC_Info child node with the relevant credit card information.</documentation>
807− </annotation>
808− </attribute>
809− </complexType>
810− </element>
811− <element name="EnhancedMultipleFOP" minOccurs="0">
812− <annotation>
813− <documentation>EnhancedMultipleCC_FOP is only valid for SabreSonic-based airlines who have actived the enhanced multiple form of payment option, cannot combine with .../MultipleFOP.</documentation>
814− </annotation>
815− <complexType>
816− <sequence>
817− <element name="Fare">
818− <complexType>
819− <attribute name="Amount" type="string" use="required">
820− <annotation>
821− <documentation>"Amount" is used to specify the fare amount to be applied to the second FOP.</documentation>
822− </annotation>
823− </attribute>
824− </complexType>
825− </element>
826− <element name="FOP_One">
827− <complexType>
828− <sequence>
829− <element name="CC_Info" minOccurs="0">
830− <complexType>
831− <sequence>
832− <element name="PaymentCard">
833− <complexType>
834− <attribute name="CardSecurityCode" type="string" use="optional">
835− <annotation>
836− <documentation>"CardSecurityCode" is used to specify a credit card security code.</documentation>
837− </annotation>
838− </attribute>
839− <attribute name="Code" type="string" use="required">
840− <annotation>
841− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
842− </annotation>
843− </attribute>
844− <attribute name="ExpireDate" type="spct:expireDate" use="required">
845− <annotation>
846− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM.</documentation>
847− </annotation>
848− </attribute>
849− <attribute name="ExtendedPayment" type="integer" use="optional">
850− <annotation>
851− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
852− </annotation>
853− </attribute>
854− <attribute name="ManualApprovalCode" type="string" use="optional">
855− <annotation>
856− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
857− </annotation>
858− </attribute>
859− <attribute name="Number" type="integer" use="required">
860− <annotation>
861− <documentation>"Number" is used to specify the credit card number.</documentation>
862− </annotation>
863− </attribute>
864− </complexType>
865− </element>
866− </sequence>
867− </complexType>
868− </element>
869− </sequence>
870− <attribute name="Type" type="string" use="optional"/>
871− </complexType>
872− </element>
873− <element name="FOP_Two">
874− <complexType>
875− <sequence>
876− <element name="CC_Info" minOccurs="0">
877− <complexType>
878− <sequence>
879− <element name="PaymentCard">
880− <complexType>
881− <attribute name="CardSecurityCode" type="string" use="optional">
882− <annotation>
883− <documentation>"CardSecurityCode" is used to specify a credit card security code.</documentation>
884− </annotation>
885− </attribute>
886− <attribute name="Code" type="string" use="required">
887− <annotation>
888− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
889− </annotation>
890− </attribute>
891− <attribute name="ExpireDate" type="spct:expireDate" use="required">
892− <annotation>
893− <documentation>"ExpireDate" is used to specify the credit card expiration date, follows this format: YYYY-MM.</documentation>
894− </annotation>
895− </attribute>
896− <attribute name="ExtendedPayment" type="integer" use="optional">
897− <annotation>
898− <documentation>"ExtendedPayment" is used to specify extended payment if applicable.</documentation>
899− </annotation>
900− </attribute>
901− <attribute name="ManualApprovalCode" type="string" use="optional">
902− <annotation>
903− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
904− </annotation>
905− </attribute>
906− <attribute name="Number" type="integer" use="required">
907− <annotation>
908− <documentation>"Number" is used to specify the credit card number.</documentation>
909− </annotation>
910− </attribute>
911− </complexType>
912− </element>
913− </sequence>
914− </complexType>
915− </element>
916− </sequence>
917− <attribute name="Type" type="string" use="optional"/>
918− </complexType>
919− </element>
920− <element name="Taxes">
921− <complexType>
922− <sequence>
923− <element name="Tax">
924− <complexType>
925− <attribute name="Amount" type="string" use="required">
926− <annotation>
927− <documentation>"Amount" is used to specify the tax amount.</documentation>
928− </annotation>
929− </attribute>
930− <attribute name="TaxCode" type="string" use="required">
931− <annotation>
932− <documentation>"TaxCode" is used to specify the tax code.</documentation>
933− </annotation>
934− </attribute>
935− </complexType>
936− </element>
937− </sequence>
938− </complexType>
939− </element>
940− </sequence>
941− </complexType>
942− </element>
943− <element name="MultipleFOP" minOccurs="0">
944− <annotation>
945− <documentation>MultipleFOP cannot combine with .../EnhancedMultipleFOP.</documentation>
946− </annotation>
947− <complexType>
948− <sequence>
949− <element name="Fare">
950− <complexType>
951− <attribute name="Amount" type="string" use="required">
952− <annotation>
953− <documentation>"Amount" is used to specify the fare amount to be applied to the second FOP.</documentation>
954− </annotation>
955− </attribute>
956− </complexType>
957− </element>
958− <element name="FOP_One">
959− <complexType>
960− <sequence>
961− <element name="CC_Info" minOccurs="0">
962− <complexType>
963− <sequence>
964− <element name="PaymentCard">
965− <complexType>
966− <attribute name="Code" type="string" use="required">
967− <annotation>
968− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
969− </annotation>
970− </attribute>
971− <attribute name="ManualApprovalCode" type="string" use="optional">
972− <annotation>
973− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
974− </annotation>
975− </attribute>
976− <attribute name="Number" type="integer" use="required">
977− <annotation>
978− <documentation>"Number" is used to specify the credit card number.</documentation>
979− </annotation>
980− </attribute>
981− </complexType>
982− </element>
983− </sequence>
984− </complexType>
985− </element>
986− </sequence>
987− <attribute name="Type" type="string" use="optional">
988− <annotation>
989− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA," (cash) "CK," (check) "CQ," (cheque) "PT," "PTACA," (PTA cash) "PTAGTCK." (PTA agency check) or "PTCK" (PTA check). If utilizing a credit card please omit @Type, and populate the .../CC_Info child node, unless needing to specify a PTA credit card form of payment. For a PTA credit card form of payment the client should pass Type="PT" and populate the .../CC_Info child node with the relevant credit card information.</documentation>
990− </annotation>
991− </attribute>
992− </complexType>
993− </element>
994− <element name="FOP_Two">
995− <complexType>
996− <sequence>
997− <element name="CC_Info" minOccurs="0">
998− <complexType>
999− <sequence>
1000− <element name="PaymentCard">
1001− <complexType>
1002− <attribute name="Code" type="string" use="required">
1003− <annotation>
1004− <documentation>"Code" is used to specify the credit card vendor code.</documentation>
1005− </annotation>
1006− </attribute>
1007− <attribute name="ManualApprovalCode" type="string" use="optional">
1008− <annotation>
1009− <documentation>"ManualApprovalCode" is used to specify a manual credit card approval code if applicable.</documentation>
1010− </annotation>
1011− </attribute>
1012− <attribute name="Number" type="integer" use="required">
1013− <annotation>
1014− <documentation>"Number" is used to specify the credit card number.</documentation>
1015− </annotation>
1016− </attribute>
1017− </complexType>
1018− </element>
1019− </sequence>
1020− </complexType>
1021− </element>
1022− </sequence>
1023− <attribute name="Type" type="string" use="optional">
1024− <annotation>
1025− <documentation>"Type" is used to specify the payment type. Acceptable values are "CA,"CK," or "CQ." If utilizing a credit card please omit @Type, and populate the .../CCInfo child node.</documentation>
1026− </annotation>
1027− </attribute>
1028− </complexType>
1029− </element>
1030− <element name="Taxes" minOccurs="0">
1031− <complexType>
1032− <sequence>
1033− <element name="Tax">
1034− <complexType>
1035− <attribute name="Amount" type="string" use="required">
1036− <annotation>
1037− <documentation>"Amount" is used to specify the tax amount.</documentation>
1038− </annotation>
1039− </attribute>
1040− <attribute name="TaxCode" type="string" use="required">
1041− <annotation>
1042− <documentation>"TaxCode" is used to specify the tax code.</documentation>
1043− </annotation>
1044− </attribute>
1045− </complexType>
1046− </element>
1047− </sequence>
1048− </complexType>
1049− </element>
1050− </sequence>
1051− </complexType>
1052− </element>
1053− </sequence>
1054− </complexType>
1055− </element>
1056− </sequence>
1057− </complexType>
1058− </element>
1059− <element name="MiscQualifiers" minOccurs="0">
1060− <complexType>
1061− <sequence>
1062− <element name="AirExtras" minOccurs="0" maxOccurs="unbounded">
1063− <complexType>
1064− <attribute name="EndNumber" type="integer" use="optional">
1065− <annotation>
1066− <documentation>"EndNumber" is used to specify the final EMD number when specifying a range.</documentation>
1067− </annotation>
1068− </attribute>
1069− <attribute name="Number" type="integer" use="required">
1070− <annotation>
1071− <documentation>"Number" is used to specify and EMD number.</documentation>
1072− </annotation>
1073− </attribute>
1074− </complexType>
1075− </element>
1076− <element name="BaggageAllowance" minOccurs="0">
1077− <annotation>
1078− <documentation>Cannot combine with PhaseIV.</documentation>
1079− </annotation>
1080− <complexType>
1081− <attribute name="Number" type="string" use="optional">
1082− <annotation>
1083− <documentation>"Number" is used to specify the quantity of checked bags if applicable.</documentation>
1084− </annotation>
1085− </attribute>
1086− <attribute name="Weight" type="string" use="optional">
1087− <annotation>
1088− <documentation>"Weight" is used to specify the weight in kilos of checked bags if applicable.</documentation>
1089− </annotation>
1090− </attribute>
1091− </complexType>
1092− </element>
1093− <element name="Certificate" minOccurs="0" maxOccurs="2">
1094− <complexType>
1095− <attribute name="Number" type="string" use="required">
1096− <annotation>
1097− <documentation>"Number" is used to specify a ticket number. Please note that this qualifier is only applicable to Sabre Sonic-hosted carriers.</documentation>
1098− </annotation>
1099− </attribute>
1100− </complexType>
1101− </element>
1102− <element name="Commission" minOccurs="0">
1103− <complexType>
1104− <attribute name="Amount" type="decimal" use="optional">
1105− <annotation>
1106− <documentation>"Amount" is used to specify the numeric amount of commission being claimed if applicable.</documentation>
1107− </annotation>
1108− </attribute>
1109− <attribute name="Percent" type="decimal" use="optional">
1110− <annotation>
1111− <documentation>"Percent" is used to specify the precentage of commission being claimed if applicable.</documentation>
1112− </annotation>
1113− </attribute>
1114− </complexType>
1115− </element>
1116− <element name="DateOfBirth" minOccurs="0">
1117− <annotation>
1118− <documentation>"DOB" is used to instruct the system to take the passenger's date of birth-related information from the SSR PNR field, and pass it into the host-based ticketing application. This is required for clients based in the Russian Federation.</documentation>
1119− </annotation>
1120− </element>
1121− <element name="Endorsement" minOccurs="0">
1122− <complexType>
1123− <sequence>
1124− <element name="Text" type="string"/>
1125− </sequence>
1126− <attribute name="Override" type="boolean" use="optional"/>
1127− </complexType>
1128− </element>
1129− <element name="FutureTicket" minOccurs="0">
1130− <complexType>
1131− <sequence>
1132− <element name="Line" maxOccurs="unbounded">
1133− <annotation>
1134− <documentation>"Line" and its associated attributes are used to issue tickets from specific FP lines.</documentation>
1135− </annotation>
1136− <complexType>
1137− <attribute name="EndNumber" type="integer" use="optional"/>
1138− <attribute name="NameNumber" type="string" use="optional"/>
1139− <attribute name="Number" type="integer" use="required"/>
1140− </complexType>
1141− </element>
1142− </sequence>
1143− </complexType>
1144− </element>
1145− <element name="Invoice" minOccurs="0">
1146− <annotation>
1147− <documentation>"Invoice" is used to specify to print invoice at time of ticketing.</documentation>
1148− </annotation>
1149− <complexType>
1150− <attribute name="Ind" type="boolean" use="optional"/>
1151− <attribute name="ETReceipt" type="boolean" use="optional"/>
1152− </complexType>
1153− </element>
1154− <element name="NeedPrint" minOccurs="0">
1155− <annotation>
1156− <documentation>Please note that only two of the three attributes can be set to true simultaneously.</documentation>
1157− </annotation>
1158− <complexType>
1159− <attribute name="AuditorCoupon" type="boolean" use="required">
1160− <annotation>
1161− <documentation>"AuditorCoupon" is used to specify to print an auditor coupon. Please note that this qualifier is only applicable to Sabre Sonic-hosted carriers.</documentation>
1162− </annotation>
1163− </attribute>
1164− <attribute name="Itinerary" type="boolean" use="required">
1165− <annotation>
1166− <documentation>"Itinerary" is used to specify to print an itinerary. Please note that this qualifier is only applicable to Sabre Sonic-hosted carriers.</documentation>
1167− </annotation>
1168− </attribute>
1169− <attribute name="PassengerReceipt" type="boolean" use="required">
1170− <annotation>
1171− <documentation>"PassengerReceipt" is used to specify to print a passenger receipt. Please note that this qualifier is only applicable to Sabre Sonic-hosted carriers.</documentation>
1172− </annotation>
1173− </attribute>
1174− </complexType>
1175− </element>
1176− <element name="NetRemit" minOccurs="0">
1177− <complexType>
1178− <attribute name="Amount" type="decimal" use="optional"/>
1179− <attribute name="ContractAgreementCode" type="string" use="optional"/>
1180− <attribute name="NetCreditAmount" type="decimal" use="optional"/>
1181− <attribute name="ValueCode" type="string" use="optional"/>
1182− </complexType>
1183− </element>
1184− <element name="Ticket" minOccurs="0">
1185− <complexType>
1186− <attribute name="Action" type="string" use="optional">
1187− <annotation>
1188− <documentation>"Action" is used to specify an action code. Please note that this qualifier is only applicable to Sabre Sonic-hosted carriers.</documentation>
1189− </annotation>
1190− </attribute>
1191− <attribute name="Type" type="string" use="optional">
1192− <annotation>
1193− <documentation>"Type" is used to specify the type of ticket to issue. Acceptable values for Type: ETR = electronic ticket (default), EMD= Electronic Miscellaneous Document, XETR = paper ticket, VCR = paper ticket (for airline use only).</documentation>
1194− </annotation>
1195− </attribute>
1196− </complexType>
1197− </element>
1198− <element name="TourCode" minOccurs="0">
1199− <complexType>
1200− <sequence>
1201− <element name="SuppressFareReplaceWithBT" minOccurs="0">
1202− <annotation>
1203− <documentation>This is not applicable to ARC subscribers.</documentation>
1204− </annotation>
1205− <complexType>
1206− <attribute name="Ind" type="boolean" use="required">
1207− <annotation>
1208− <documentation>"Ind" is used to specify to suppress the fare amount on the ticket and replace with BT.</documentation>
1209− </annotation>
1210− </attribute>
1211− </complexType>
1212− </element>
1213− <element name="SuppressFareReplaceWithIT" minOccurs="0">
1214− <complexType>
1215− <attribute name="Ind" type="boolean" use="required">
1216− <annotation>
1217− <documentation>"Ind" is used to specify to suppress the fare amount on the ticket and replace with IT.</documentation>
1218− </annotation>
1219− </attribute>
1220− </complexType>
1221− </element>
1222− <element name="SuppressIT" minOccurs="0">
1223− <complexType>
1224− <attribute name="Ind" type="boolean" use="required">
1225− <annotation>
1226− <documentation>"Ind" is used to specify to to suppress the IT in the tourcode box from printing.</documentation>
1227− </annotation>
1228− </attribute>
1229− </complexType>
1230− </element>
1231− <element name="SuppressITSupressFare" minOccurs="0">
1232− <complexType>
1233− <attribute name="Ind" type="boolean" use="required">
1234− <annotation>
1235− <documentation>"Ind" is used to specify to specify to suppress IT from printing in the tour box on the ticket and to suppress fare amounts from printing on the ticket.</documentation>
1236− </annotation>
1237− </attribute>
1238− </complexType>
1239− </element>
1240− <element name="Text" type="string" minOccurs="0"/>
1241− </sequence>
1242− </complexType>
1243− </element>
1244− </sequence>
1245− </complexType>
1246− </element>
1247− <element name="PricingQualifiers" minOccurs="0">
1248− <complexType>
1249− <sequence>
1250− <element name="Brand" minOccurs="0" maxOccurs="unbounded">
1251− <annotation>
1252− <documentation>"Brand" is used to specify a brand. Please note that it's not possible to request more than 1 brand for an entire journey, or for the same segment.</documentation>
1253− </annotation>
1254− <complexType>
1255− <simpleContent>
1256− <extension base="string">
1257− <attribute name="RPH" type="integer" use="optional">
1258− <annotation>
1259− <documentation>"RPH" is used to match up with ".../ItineraryOptions/Segment".</documentation>
1260− </annotation>
1261− </attribute>
1262− </extension>
1263− </simpleContent>
1264− </complexType>
1265− </element>
1266− <element name="FareFocusExclude" minOccurs="0">
1267− <annotation>
1268− <documentation>"FareFocusExclude" is used to exclude fare focus fares based on business rules of the agency. Please note that this qualifier cannot be combined with .../PriceQuote</documentation>
1269− </annotation>
1270− <complexType>
1271− <attribute name="Ind" type="boolean" use="required"/>
1272− </complexType>
1273− </element>
1274− <element name="Fare" minOccurs="0">
1275− <complexType>
1276− <attribute name="Type" type="string" use="required">
1277− <annotation>
1278− <documentation>"Type" is used to specify a fare type. Acceptable values are "NL" for normal fare, "EX" for special fare, and 'IT" for inclusive tour.</documentation>
1279− </annotation>
1280− </attribute>
1281− </complexType>
1282− </element>
1283− <element name="ItineraryOptions" minOccurs="0">
1284− <complexType>
1285− <sequence>
1286− <element name="SegmentSelect" minOccurs="0" maxOccurs="unbounded">
1287− <complexType>
1288− <attribute name="EndNumber" type="integer" use="optional"/>
1289− <attribute name="Number" type="integer" use="required"/>
1290− <attribute name="RPH" type="string" use="optional">
1291− <annotation>
1292− <documentation>"RPH" is used to match up with ".../SpecificFare/@RPH" or .../Brand.</documentation>
1293− </annotation>
1294− </attribute>
1295− </complexType>
1296− </element>
1297− <element name="SideTrip" minOccurs="0">
1298− <annotation>
1299− <documentation>"SideTrip" is used to instruct the system to price the specified itinerary segments as a side trip.</documentation>
1300− </annotation>
1301− <complexType>
1302− <attribute name="EndNumber" type="integer" use="optional"/>
1303− <attribute name="Number" type="integer" use="required"/>
1304− </complexType>
1305− </element>
1306− </sequence>
1307− </complexType>
1308− </element>
1309− <element name="NameSelect" minOccurs="0" maxOccurs="unbounded">
1310− <annotation>
1311− <documentation>"NameSelect" is used to instruct the system to price theitinerary based upon a particular name field.</documentation>
1312− </annotation>
1313−
1314− <complexType>
1315− <attribute name="EndNameNumber" type="string" use="optional"/>
1316− <attribute name="NameNumber" type="string" use="required"/>
1317− </complexType>
1318− </element>
1319− <element name="PhaseIV" minOccurs="0" maxOccurs="7">
1320− <annotation>
1321− <documentation>Cannot combine with .../PriceQuote.</documentation>
1322− </annotation>
1323− <complexType>
1324− <sequence>
1325− <element name="NameSelect" minOccurs="0" maxOccurs="unbounded">
1326− <annotation>
1327− <documentation>"NameSelect" is used to instruct the system to price theitinerary based upon a particular name field.</documentation>
1328− </annotation>
1329− <complexType>
1330− <attribute name="EndNameNumber" type="string" use="optional"/>
1331− <attribute name="NameNumber" type="string" use="required"/>
1332− </complexType>
1333− </element>
1334− </sequence>
1335− <attribute name="Number" type="integer" use="required"/>
1336− </complexType>
1337− </element>
1338− <element name="PriceQuote" minOccurs="0" maxOccurs="unbounded">
1339− <annotation>
1340− <documentation>Cannot combine with .../NameSelect. Cannot combine with .../PhaseIV.</documentation>
1341− </annotation>
1342− <complexType>
1343− <sequence>
1344− <element name="NameSelect" minOccurs="0" maxOccurs="unbounded">
1345− <annotation>
1346− <documentation>"NameSelect" is used to instruct the system to price theitinerary based upon a particular name field.</documentation>
1347− </annotation>
1348− <complexType>
1349− <attribute name="EndNameNumber" type="decimal" use="optional"/>
1350− <attribute name="NameNumber" type="decimal" use="required"/>
1351− </complexType>
1352− </element>
1353− <element name="Record" minOccurs="0" maxOccurs="unbounded">
1354− <annotation>
1355− <documentation>In order to specify multiple PQR records to be issued please specify a range or specific record numbers by means of the element repetition. .../Ticketing/PricingQualifiers/PriceQuote/Record/@Reissue cannot be combined with .../Ticketing/MiscQualifiers/Ticket</documentation>
1356− </annotation>
1357− <complexType>
1358− <attribute name="EndNumber" type="integer" use="optional">
1359− <annotation>
1360− <documentation>"EndNumber" is used to specify the ending PQ number in a range.</documentation>
1361− </annotation>
1362− </attribute>
1363− <attribute name="Number" type="integer" use="required">
1364− <annotation>
1365− <documentation>"Number" is used to specify a PQ number.</documentation>
1366− </annotation>
1367− </attribute>
1368− <attribute name="Reissue" type="boolean" use="optional">
1369− <annotation>
1370− <documentation>"Reissue" is used to indicate that the particular PQ record is a PQ Reissue record.</documentation>
1371− </annotation>
1372− </attribute>
1373− </complexType>
1374− </element>
1375− </sequence>
1376− </complexType>
1377− </element>
1378− <element name="RefundableBalance" minOccurs="0">
1379− <complexType>
1380− <sequence>
1381− <element name="Taxes" minOccurs="0">
1382− <complexType>
1383− <sequence>
1384− <element name="Tax" maxOccurs="unbounded">
1385− <complexType>
1386− <attribute name="Amount" type="string" use="required"/>
1387− <attribute name="Code" type="string" use="required"/>
1388− </complexType>
1389− </element>
1390− </sequence>
1391− </complexType>
1392− </element>
1393− </sequence>
1394− <attribute name="Amount" type="string" use="required"/>
1395− </complexType>
1396− </element>
1397− <element name="SpanishLargeFamilyDiscountLevel" minOccurs="0">
1398− <annotation>
1399− <documentation>"SpanishLargeFamilyDiscountLevel" is used to specify the Spanish large family discount level. Please note that this qualifier is only applicable to Spain-based subscribers.</documentation>
1400− </annotation>
1401− <simpleType>
1402− <restriction base="string">
1403− <enumeration value="1"/>
1404− <enumeration value="2"/>
1405− </restriction>
1406− </simpleType>
1407− </element>
1408− <element name="SpecificFare" minOccurs="0" maxOccurs="unbounded">
1409− <annotation>
1410− <documentation>Please note that the element is only applicable to Abacus.</documentation>
1411− </annotation>
1412− <complexType>
1413− <sequence>
1414− <element name="FareBasis" type="string" minOccurs="0"/>
1415− </sequence>
1416− <attribute name="RPH" type="string" use="optional">
1417− <annotation>
1418− <documentation>"RPH" is used to match up with ../OptionalQualifiers/PricingQualifiers/ItineraryOptions/Segment.</documentation>
1419− </annotation>
1420− </attribute>
1421− </complexType>
1422− </element>
1423− <element name="SpecificPenalty" minOccurs="0">
1424− <annotation>
1425− <documentation>"SpecificPenalty" is used to specify change or cancellation amounts for an itinerary.</documentation>
1426− </annotation>
1427− <complexType>
1428− <sequence>
1429− <element name="Changeable" minOccurs="0">
1430− <annotation>
1431− <documentation>It is not possible to combine "BeforeDeparture" and "AfterDeparture" within one element.</documentation>
1432− </annotation>
1433− <complexType>
1434− <attribute name="Any" type="boolean" use="optional">
1435− <annotation>
1436− <documentation>"Any" is used to specify only changeable fare options.</documentation>
1437− </annotation>
1438− </attribute>
1439− <attribute name="CurrencyCode" type="string" use="optional">
1440− <annotation>
1441− <documentation>"CurrencyCode" is used to specify the specific currency for maximum exchange penalty.</documentation>
1442− </annotation>
1443− </attribute>
1444− <attribute name="MaxPenalty" type="string" use="optional">
1445− <annotation>
1446− <documentation>"MaxPenalty" is used to specify maximum change penalty. If a value of "0" is input no penalty is preferred. If a value of "N" is input only non-changeable options are requested. Please note that monetary amount that includes a decimal is not allowed</documentation>
1447− </annotation>
1448− </attribute>
1449− <attribute name="BeforeDeparture" type="boolean" use="optional">
1450− <annotation>
1451− <documentation>"BeforeDeparture" is used to query for before depature fees.</documentation>
1452− </annotation>
1453− </attribute>
1454− <attribute name="AfterDeparture" type="boolean" use="optional">
1455− <annotation>
1456− <documentation>"AfterDeparture" is used to query for after depature fees.</documentation>
1457− </annotation>
1458− </attribute>
1459− </complexType>
1460− </element>
1461− <element name="EitherOr" minOccurs="0">
1462− <annotation>
1463− <documentation>It is not possible to combine "BeforeDeparture" and "AfterDeparture" within one element.</documentation>
1464− </annotation>
1465− <complexType>
1466− <attribute name="Any" type="boolean" use="optional">
1467− <annotation>
1468− <documentation>"Any" is used to specify only changeable fare options.</documentation>
1469− </annotation>
1470− </attribute>
1471− <attribute name="CurrencyCode" type="string" use="optional">
1472− <annotation>
1473− <documentation>"CurrencyCode" is used to specify the specific currency for maximum exchange penalty.</documentation>
1474− </annotation>
1475− </attribute>
1476− <attribute name="MaxPenalty" type="string" use="optional">
1477− <annotation>
1478− <documentation>"MaxPenalty" is used to specify maximum change penalty. If a value of "0" is input no penalty is preferred. If a value of "N" is input only non-changeable options are requested. Please note that monetary amount that includes a decimal is not allowed</documentation>
1479− </annotation>
1480− </attribute>
1481− <attribute name="BeforeDeparture" type="boolean" use="optional">
1482− <annotation>
1483− <documentation>"BeforeDeparture" is used to query for before depature fees.</documentation>
1484− </annotation>
1485− </attribute>
1486− <attribute name="AfterDeparture" type="boolean" use="optional">
1487− <annotation>
1488− <documentation>"AfterDeparture" is used to query for after depature fees.</documentation>
1489− </annotation>
1490− </attribute>
1491− </complexType>
1492− </element>
1493− <element name="Refundable" minOccurs="0">
1494− <annotation>
1495− <documentation>It is not possible to combine "BeforeDeparture" and "AfterDeparture" within one element.</documentation>
1496− </annotation>
1497− <complexType>
1498− <attribute name="Any" type="boolean" use="optional">
1499− <annotation>
1500− <documentation>"Any" is used to specify only changeable fare options.</documentation>
1501− </annotation>
1502− </attribute>
1503− <attribute name="CurrencyCode" type="string" use="optional">
1504− <annotation>
1505− <documentation>"CurrencyCode" is used to specify the specific currency for maximum exchange penalty.</documentation>
1506− </annotation>
1507− </attribute>
1508− <attribute name="MaxPenalty" type="string" use="optional">
1509− <annotation>
1510− <documentation>"MaxPenalty" is used to specify maximum change penalty. If a value of "0" is input no penalty is preferred. If a value of "N" is input only non-changeable options are requested. Please note that monetary amount that includes a decimal is not allowed</documentation>
1511− </annotation>
1512− </attribute>
1513− <attribute name="BeforeDeparture" type="boolean" use="optional">
1514− <annotation>
1515− <documentation>"BeforeDeparture" is used to query for before depature fees.</documentation>
1516− </annotation>
1517− </attribute>
1518− <attribute name="AfterDeparture" type="boolean" use="optional">
1519− <annotation>
1520− <documentation>"AfterDeparture" is used to query for after depature fees.</documentation>
1521− </annotation>
1522− </attribute>
1523− </complexType>
1524− </element>
1525− </sequence>
1526− <attribute name="AdditionalInfo" type="boolean" use="optional">
1527− <annotation>
1528− <documentation>"AdditionalInfo" is used to receive additional tags with information on fare flexibility.</documentation>
1529− </annotation>
1530− </attribute>
1531− </complexType>
1532− </element>
1533− <element name="Taxes" minOccurs="0">
1534− <complexType>
1535− <sequence>
1536− <element name="NoTax" minOccurs="0">
1537− <complexType>
1538− <attribute name="Ind" type="boolean" use="optional"/>
1539− </complexType>
1540− </element>
1541− <element name="TaxExempt" minOccurs="0" maxOccurs="5">
1542− <complexType>
1543− <attribute name="Code" type="string" use="optional"/>
1544− </complexType>
1545− </element>
1546− </sequence>
1547− </complexType>
1548− </element>
1549− <element name="ValidityDates" minOccurs="0" maxOccurs="unbounded">
1550− <annotation>
1551− <documentation>This node is used to specify ticket validity dates.Cannot combine with PhaseIV.</documentation>
1552− </annotation>
1553− <complexType>
1554− <sequence>
1555− <element name="NotValidAfter" type="spct:date" minOccurs="0"/>
1556− <element name="NotValidBefore" type="spct:date" minOccurs="0"/>
1557− <element name="Segment" maxOccurs="unbounded">
1558− <complexType>
1559− <attribute name="EndNumber" type="integer" use="optional"/>
1560− <attribute name="Number" type="integer" use="required"/>
1561− </complexType>
1562− </element>
1563− </sequence>
1564− </complexType>
1565− </element>
1566− </sequence>
1567− </complexType>
1568− </element>
1569− </sequence>
1570− </complexType>
1571− </element>
1572− <element name="PostProcessing" minOccurs="0">
1573− <complexType>
1574− <sequence>
1575− <element name="EndTransaction" minOccurs="0">
1576− <annotation>
1577− <documentation>"EndTransaction" is used to end the transaction and finalize the record.</documentation>
1578− </annotation>
1579− <complexType>
1580− <sequence>
1581− <element name="Source">
1582− <complexType>
1583− <attribute name="ReceivedFrom" type="string" use="required">
1584− <annotation>
1585− <documentation>"ReceivedFrom" is used to receive the record.</documentation>
1586− </annotation>
1587− </attribute>
1588− </complexType>
1589− </element>
1590− <element name="Email" minOccurs="0">
1591− <annotation>
1592− <documentation>"Email" is used to send an email notification upon end transaction to any email addresses contained within the particular record.</documentation>
1593− </annotation>
1594− <complexType>
1595− <sequence>
1596− <element name="eTicket" minOccurs="0">
1597− <annotation>
1598− <documentation>"eTicket" is used to send an email notification containing a text-based copy of the eTicket, cannot combine with .../Invoice, or .../Itinerary..</documentation>
1599− </annotation>
1600− <complexType>
1601− <sequence>
1602− <element name="PDF" minOccurs="0">
1603− <complexType>
1604− <attribute name="Ind" type="boolean" use="required"/>
1605− </complexType>
1606− </element>
1607− </sequence>
1608− <attribute name="Ind" type="boolean" use="required"/>
1609− </complexType>
1610− </element>
1611− <element name="Invoice" minOccurs="0">
1612− <annotation>
1613− <documentation>"Invoice" is used to send an email notification containing a text-based copy of the invoice. Invoice cannot combine with .../eTicket, or .../Itinerary.</documentation>
1614− </annotation>
1615− <complexType>
1616− <attribute name="Ind" type="boolean" use="required"/>
1617− </complexType>
1618− </element>
1619− <element name="Itinerary" minOccurs="0">
1620− <annotation>
1621− <documentation>"Itinerary" is used to send an email notification containing a text-based copy of the itinerary. Itinerary cannot combine with .../eTicket, or .../Invoice.</documentation>
1622− </annotation>
1623− <complexType>
1624− <sequence>
1625− <element name="PDF" minOccurs="0">
1626− <annotation>
1627− <documentation>"PDF" is used to send an email notification containing a PDF-based copy of the itinerary.</documentation>
1628− </annotation>
1629− <complexType>
1630− <attribute name="Ind" type="boolean" use="required"/>
1631− </complexType>
1632− </element>
1633− <element name="Segment" minOccurs="0" maxOccurs="unbounded">
1634− <complexType>
1635− <attribute name="EndNumber" type="integer" use="optional">
1636− <annotation>
1637− <documentation>"EndNumber" is used to specify an ending segment in the range to include in the email message.</documentation>
1638− </annotation>
1639− </attribute>
1640− <attribute name="Number" type="integer" use="required">
1641− <annotation>
1642− <documentation>"Number" is used to specify a segment number to include in the email message.</documentation>
1643− </annotation>
1644− </attribute>
1645− </complexType>
1646− </element>
1647− </sequence>
1648− <attribute name="Ind" type="boolean" use="required"/>
1649− </complexType>
1650− </element>
1651− <element name="PersonName" minOccurs="0">
1652− <complexType>
1653− <attribute name="NameNumber" type="string" use="required">
1654− <annotation>
1655− <documentation>"NameNumber" is used to specify a particular passenger name number to send the email notification to. Please note that the email address in the PNR's email field must be name associated to the specified name number.</documentation>
1656− </annotation>
1657− </attribute>
1658− </complexType>
1659− </element>
1660− </sequence>
1661− <attribute name="Ind" type="boolean" use="required"/>
1662− </complexType>
1663− </element>
1664− </sequence>
1665− </complexType>
1666− </element>
1667− </sequence>
1668− <attribute name="acceptNegotiatedFare" type="boolean" use="optional">
1669− <annotation>
1670− <documentation>"acceptNegotiatedFare" is used to accept a negotiated fare when it is not possible to ticket the stored fare.</documentation>
1671− </annotation>
1672− </attribute>
1673− <attribute name="acceptPriceChanges" type="boolean" use="optional">
1674− <annotation>
1675− <documentation>"acceptPriceChanges" is used to specify that system should issue a ticket even if price increases while processing.</documentation>
1676− </annotation>
1677− </attribute>
1678− <attribute name="actionOnPQExpired" use="optional">
1679− <annotation>
1680− <documentation>"actionOnPQExpired" is used to specify appropriate action when Price Quote expires. Available options are "R" - reprice, "Q" Quit, "O" Override.</documentation>
1681− </annotation>
1682− <simpleType>
1683− <restriction base="string">
1684− <enumeration value="O"/>
1685− <enumeration value="Q"/>
1686− <enumeration value="R"/>
1687− </restriction>
1688− </simpleType>
1689− </attribute>
1690− </complexType>
1691− </element>
1692− </sequence>
1693− <attribute name="targetCity" type="string" use="optional">
1694− <annotation>
1695− <documentation>"TargetCity" is used to specify to which city service should change context using ContextChange (AAA) and the rest of the service uses new security. If empty or equals current city the context doesn't change.</documentation>
1696− </annotation>
1697− </attribute>
1698− </extension>
1699− </complexContent>
1700− </complexType>
1701− </element>
1702−</schema>
test/fixtures/retrieve_seat_map.xmldeleted−600
@@ -1,600 +0,0 @@
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.xsddeleted−18
@@ -1,18 +0,0 @@
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>
xsd-parser.cabal+12−19
@@ -18,16 +18,10 @@ extra-source-files: CHANGELOG.md
1818
1919
2020library
21− -- ghc-options: -Werror
2221 -- Modules exported by the library.
23− exposed-modules: Text.XSD
24− , Text.XSD.Parser
25− , Text.XSD.Internal
26−
27− default-extensions: OverloadedStrings
28− , LambdaCase
29− , QuasiQuotes
30− , TemplateHaskell
22+ exposed-modules: Xsd
23+ , Xsd.Types
24+ , Xsd.Parser
3125
3226 -- Other library packages from which modules are imported.
3327 build-depends: base ^>=4.12.0.0
@@ -41,9 +35,14 @@ library
4135 , xml-conduit
4236 , writer-cps-mtl
4337 , uniplate
38+ , network-uri
39+ , http-client
40+ , http-client-tls
41+ , filepath
4442
4543 -- Directories containing source files.
4644 hs-source-dirs: src
45+ ghc-options: -Wall
4746
4847 -- Base language which the package is written in.
4948 default-language: Haskell2010
@@ -52,20 +51,14 @@ test-suite spec
5251 type: exitcode-stdio-1.0
5352 hs-source-dirs: test
5453 main-is: Main.hs
54+ other-modules: Spec
5555 build-depends: base
5656 , bytestring
57+ , text
5758 , hspec
5859 , transformers
5960 , xml-conduit
61+ , containers
6062 , xsd-parser
6163 default-language: Haskell2010
62− default-extensions: CPP
63− , DeriveGeneric
64− , FlexibleInstances
65− , LambdaCase
66− , OverloadedStrings
67− , StandaloneDeriving
68− , TemplateHaskell
69− , TupleSections
70− , TypeFamilies
71− ghc-options: -Wall -fno-warn-missing-signatures
64+ ghc-options: -Wall