git.iko.soy/typeable/xsd-isogen
on fcce135 help sign in
3 files changed−133
since splitsnapshots
unifiedsplit
golden/extension_dep.xsd−31 golden/extension_dep.xsd.hs−101 src/Main.hs−1
golden/extension_dep.xsddeleted−31
@@ -1,31 +0,0 @@
1−<?xml version="1.0"?>
2−<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3− <xs:complexType name="X">
4− <xs:sequence>
5− <xs:element name="s" type="xs:string"/>
6− </xs:sequence>
7− </xs:complexType>
8− <xs:complexType name="B">
9− <xs:sequence>
10− <xs:element name="s" type="xs:string"/>
11− </xs:sequence>
12− </xs:complexType>
13− <xs:complexType name="C">
14− <xs:complexContent>
15− <xs:extension base="B">
16− <xs:sequence>
17− <xs:element name="x" type="X"/>
18− </xs:sequence>
19− </xs:extension>
20− </xs:complexContent>
21− </xs:complexType>
22− <xs:complexType name="A">
23− <xs:complexContent>
24− <xs:extension base="C">
25− <xs:sequence>
26− <xs:element name="i" type="xs:int"/>
27− </xs:sequence>
28− </xs:extension>
29− </xs:complexContent>
30− </xs:complexType>
31−</xs:schema>
golden/extension_dep.xsd.hsdeleted−101
@@ -1,101 +0,0 @@
1−-- This file was generated by xsd-isogen version 0.1.0.0
2−-- https://github.com/dredozubov/xsd-isogen
3−
4−{-# OPTIONS_GHC -Wno-unused-imports #-}
5−module Dummy where
6−
7−import Control.DeepSeq
8−import Data.Scientific
9−import Data.THGen.XML
10−import Text.XML.DOM.Parser
11−import Text.XML.Writer
12−import Text.XML.ParentAttributes
13−import Prelude hiding ((*), (+))
14−
15−
16−{-|
17−Generated from: X
18−-}
19−"X" =:= record ParserAndGenerator
20− ! "s" [t|Text|]
21−
22−{-|
23−Generated from: A
24−-}
25−"A" =:= record ParserAndGenerator
26− ! "s" [t|Text|]
27− ! "x" [t|XmlX|]
28− ! "i" [t|Integer|]
29−
30−{-|
31−Generated from: B
32−-}
33−"B" =:= record ParserAndGenerator
34− ! "s" [t|Text|]
35−
36−{-|
37−Generated from: C
38−-}
39−"C" =:= record ParserAndGenerator
40− ! "s" [t|Text|]
41− ! "x" [t|XmlX|]
42−
43−data AnyXmlC
44− = TheXmlC !XmlC
45− | TheXmlA !XmlA
46− deriving (Eq, Show)
47−
48−instance NFData AnyXmlC where
49− rnf = rwhnf
50−
51−instance FromDom AnyXmlC where
52− fromDom = do
53− tp <- parseAttribute
54− (matchName "{http://www.w3.org/2001/XMLSchema-instance}type")
55− Right
56− case tp of
57− "C" -> TheXmlC <$> fromDom
58− "A" -> TheXmlA <$> fromDom
59− _ -> throwParserError (PEOther "Unexpected type")
60−
61−instance ToXML AnyXmlC where
62− toXML (TheXmlC a) = toXML a
63− toXML (TheXmlA a) = toXML a
64−
65−instance ToXmlParentAttributes AnyXmlC where
66− toXmlParentAttributes (TheXmlC a) =
67− ("{http://www.w3.org/2001/XMLSchema-instance}type", "C")
68− : toXmlParentAttributes a
69− toXmlParentAttributes (TheXmlA a) =
70− ("{http://www.w3.org/2001/XMLSchema-instance}type", "A")
71− : toXmlParentAttributes a
72−data AnyXmlB
73− = TheXmlB !XmlB
74− | TheAnyXmlC !AnyXmlC
75− deriving (Eq, Show)
76−
77−instance NFData AnyXmlB where
78− rnf = rwhnf
79−
80−instance FromDom AnyXmlB where
81− fromDom = do
82− tp <- parseAttribute
83− (matchName "{http://www.w3.org/2001/XMLSchema-instance}type")
84− Right
85− case tp of
86− "B" -> TheXmlB <$> fromDom
87− "C" -> TheAnyXmlC <$> fromDom
88− _ -> throwParserError (PEOther "Unexpected type")
89−
90−instance ToXML AnyXmlB where
91− toXML (TheXmlB a) = toXML a
92− toXML (TheAnyXmlC a) = toXML a
93−
94−instance ToXmlParentAttributes AnyXmlB where
95− toXmlParentAttributes (TheXmlB a) =
96− ("{http://www.w3.org/2001/XMLSchema-instance}type", "B")
97− : toXmlParentAttributes a
98− toXmlParentAttributes (TheAnyXmlC a) =
99− ("{http://www.w3.org/2001/XMLSchema-instance}type", "C")
100− : toXmlParentAttributes a
101−
src/Main.hs−1
@@ -294,7 +294,6 @@ genFields typeName (Xsd.ContentPlain c) =
294294genFields _ (Xsd.ContentSimple _) = return []
295295genFields typeName (Xsd.ContentComplex (Xsd.ComplexContentExtension e)) = do
296296 base <- resolveType (Xsd.complexExtensionBase e)
297− genDependencies base
298297 baseFields <- case base of
299298 Xsd.TypeComplex t -> genFields typeName (Xsd.complexContent t)
300299 _ -> return []