forked from soapteam/soapfish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LIMITATIONS.txt
87 lines (70 loc) · 2.28 KB
/
LIMITATIONS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
== Specific limitations ==
xsd.Ref is not serialized at all
--------------------------------------
xsd.References are not serialized at all.
,-----------------------------------------------------------------------------
from soapbox import xsd
class Person(xsd.Group):
name = xsd.Element(xsd.String)
surname = xsd.Element(xsd.String)
class Job(xsd.ComplexType):
title = xsd.Element(xsd.String)
person = xsd.Ref(Person)
schema = xsd.Schema(
imports=[],
targetNamespace='http://site.example/ws/spec',
elementFormDefault='qualified',
simpleTypes=[],
attributeGroups=[],
groups=[],
complexTypes=[],
elements={'job': xsd.Element(Job())},
)
from soapbox.py2xsd import generate_xsd
xsd_ = generate_xsd(schema)
from lxml import etree
print etree.tostring(xsd_, pretty_print=True)
`-----------------------------------------------------------------------------
Result:
<xsd:schema xmlns:sns="http://site.example/ws/spec" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://site.example/ws/spec" elementFormDefault="unqualified">
<xsd:element name="job">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="title" type="xsd:string" minOccurs="1" nillable="false"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Expected result:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema targetNamespace="http://site.example/ws/spec"
xmlns:site="http://site.example/ws/spec"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="surname" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="job">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" />
<xs:element ref="site:person" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Valid xml for expected schema:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<job xmlns="http://site.example/ws/spec">
<title>developer</title>
<person>
<name>Bar</name>
<surname>Foo</surname>
</person>
</job>
===============================================================================