/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to xml/info/xsd.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
***************************************************
 
2
*********** XSD (XML Schema Definition) ***********
 
3
***************************************************
 
4
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"        XSD Namespace
 
5
        targetNamespace="something"     Says that the elements defined by
 
6
                                        this schema are to go in this namespace
 
7
        xlmns="something"               Default namespace
 
8
        elementFormDefault="qualified"> Any elements used by the instance 
 
9
                                        document which were declared in this
 
10
                                        schema must be namespace qualified
 
11
... All other code ...
 
12
</xsd:element>
 
13
 
 
14
Include
 
15
-------
 
16
<xsd:include schemaLocation="file.xsd"/>
 
17
 
 
18
Element Types
 
19
-------------
 
20
xsd:string              String
 
21
xsd:normalizedString    String without tabs, CRs, line feeds
 
22
xsd:token               Normalized String without leading/trailing/consecutive
 
23
                        spaces
 
24
xsd:boolean             true|false
 
25
xsd:integer             integer number
 
26
xsd:long                QWORD
 
27
xsd:int                 DWORD
 
28
xsd:short               WORD
 
29
xsd:byte                BYTE
 
30
xsd:nonPositiveInteger  integer in [-inf,0]
 
31
xsd:negativeInteger     integer in [-inf,-1]
 
32
xsd:positiveInteger     integer in [1,inf]
 
33
xsd:unsignedLong        QWORD
 
34
xsd:unsignedInt         DWORD
 
35
xsd:unsignedShort       WORD
 
36
xsd:unsignedByte        BYTE
 
37
xsd:decimal             7.08
 
38
xsd:float               12.56E3, INF, -INF, NAN
 
39
xsd:doble               double precision
 
40
xsd:duration            P1Y2M3DT10H30M12.3S (?)
 
41
xsd:dateTime            CCYY-MM-DDThh-mm-ss
 
42
xsd:time                hh:mm:ss.sss
 
43
xsd:date                CCYY-MM-DD
 
44
xsd:gYearMonth          CCYY-MM
 
45
xsd:gYear               CCYY
 
46
xsd:MonthDay            --MM-DD
 
47
xsd:gDay                ---DD
 
48
xsd:gMonth              --MM--
 
49
xsd:hexBinary           hex number
 
50
xsd:base64Binary        base64 string
 
51
xsd:anyURI              URI
 
52
xsd:QName               a namespace qualified name
 
53
xsd:NOTATION            a NOTATION from XML spec
 
54
xsd:language            any valid xml:lang value (e.g. EN_US, ru_RU)
 
55
xsd:Name
 
56
xsd:NCName
 
57
*                       Constructed Types, see xsd:simpleType
 
58
 
 
59
Attribute Types
 
60
---------------
 
61
ID, IDREF, IDREFS, NMTOKEN, NMTOKENS, ENTITY, and ENTITIES
 
62
 
 
63
*                       Constructed Types, see xsd:complexType
 
64
 
 
65
Declaring elements
 
66
------------------
 
67
<xsd:element name="catalog">
 
68
 ... Something ...
 
69
</xsd:element>
 
70
 
 
71
 name                   Element name
 
72
 ref="name"             Only reference on element, which will be described later
 
73
 type="xsd:string"      Type of element
 
74
 minOccurs="1"          Minimal occurences of the element
 
75
 maxOccurs="1"          Maximal number of occurences ("unbounded" - unlimited)
 
76
 fixed="hell"           ������� ���祭�� ������� (� ���� �� �� � �� 㪠���
 
77
                        � XML ���㬥�� �㤥� �������, �� � 㪠��� "hell")
 
78
 
 
79
 * If element - complex, i.e. have sub element, next construction must be used:
 
80
 <xsd:element ... >
 
81
  <xsd:complexType>
 
82
    ... sub element description ...
 
83
  </xsd:ComplexType>
 
84
 </xsd:element>
 
85
 
 
86
 * If element have greater then one sub element, then next construction must be
 
87
 used:
 
88
 <xsd:complexType>
 
89
  <xsd:sequence>
 
90
    ... sub elements description ...
 
91
  </xsd:sequence>
 
92
 </xsd:complexType>
 
93
 
 
94
 * Reusing complex types
 
95
 <xsd:complexType name="somename"> Something </xsd:complexType>
 
96
 ...
 
97
        <xsd:element name="MyName" type="somename"/>
 
98
 ...
 
99
 
 
100
 
 
101
 * Using references:
 
102
 ...
 
103
        <xsd:element ref="author" minOccurs="1" maxOccurs="1"/>
 
104
 ...
 
105
 <xsd:element name="author" ... >  ... </xsd:element>
 
106
 
 
107
Declaring new types
 
108
-------------------
 
109
<xsd:simpleType name="typename">
 
110
  <xsd:restriction base="xsd:string">           Specifing base type
 
111
     <xsd:pattern value="some pattern"/>
 
112
     <xsd:pattern value="other pattern"/>
 
113
  </xsd:restriction>
 
114
</xsd:simpleType>
 
115
 
 
116
 * Elements declared of this type must conform to one of the specified patterns
 
117
 * ���� ⨯� ����� 㪠�뢠�� ��� � ��୥ ���㬥��, � ��⮬ �������� � 
 
118
 ��� �� �����, ⠪ � � �����⭮� <xsd:element> ⮣�� �� �㤥� ������� 
 
119
 ⨯�� �⮣� �������
 
120
 
 
121
Restrictions:
 
122
-------------
 
123
 <xsd:pattern value=""> - ���祭�� ������ ᮮ⢥��⢮���� ��� �� ������ ��
 
124
                        㪠����� 蠡�����
 
125
 <xsd:length value="8"> - ������ ������ ��ப�, � ������ ��砥 ��ப� ������
 
126
                        ������ ஢�� �� ���쬨 ᨬ�����
 
127
 <xsd:minLength ...>    - �������쭠� ������ ��ப�
 
128
 <xsd:maxLength ...>    - ���ᨬ��쭠� ������ ��ப�
 
129
 <xsd:enumeration value="a">    ������ �����⭮� ���祭��, �㦭� 㪠���� 
 
130
                        ��᪮�쪮 ⠪�� ⥣��, �� �� ᮧ���� ᯨ᮪ ���������
 
131
                        ���祭��.
 
132
 <xsd:whitespace ...>   - "preserve"
 
133
                          "replace"
 
134
                          "collapse"
 
135
 <xsd:totalDigits ...>  ��᫮ ������ � �᫥
 
136
 <xsd:maxInclusive ...> ���ᨬ��쭮 �����⨬�� ���祭�� �᫠
 
137
 <xsd:maxExclusive ...> ����� ,a] -> ,a) 
 
138
 <xsd:minInclusive ...> �������쭮 �����⨬�� ���祭�� �᫠
 
139
 <xsd:minExclusive ...> ����� [a, -> (a,
 
140
 
 
141
 *                      �᫨ 㪠���� ��᪮�쪮 ���������� ⥣��, � ���祭��
 
142
                        ������ ᮮ⢥��⢮���� ��� �� ������ �� ���.
 
143
 ��ࠬ����:
 
144
  value="..."           ���祭�� ��࠭�祭��
 
145
  fixed="true"          �᫨ 㪠����, � ���� ⨯� �������騥�� �� �⮬ �� 
 
146
                        ����� �������� ���祭�� �⮣� ��࠭�祭��.
 
147
 
 
148
 Patterns:
 
149
  Example:      "\d{1}-\d{5}-\d{3}-\d{1}"        "#-#####-###-#" (# in [0..9])
 
150
  |             or (for example '(\d{1}|\d{2})')
 
151
  \d{n}:        'n' digits
 
152
  .,*,?,[],{}   As in regexp rules
 
153
  \p(L)         A letter from any language
 
154
  \p(Lu)        A Capital letter from any language
 
155
  \p(Ll)        A lower case letter from any language
 
156
  \p(N)         Number, Roman number, fractions
 
157
  \p(Nd)        Digit from any language
 
158
  \p(P)         A Punctuatuion symbol
 
159
  \p(Sc)        Currency sign, from any language
 
160
 
 
161
 
 
162
xsd:list
 
163
--------
 
164
<xsd:simpleType name="typename">
 
165
  <xsd:list itemType="xsd:int"/>
 
166
</xsd:simpleType>
 
167
 
 
168
Restrictions
 
169
------------
 
170
 * ���⢥����� ᯨ�� �� �ᥫ. ���ਬ��: 23 -13 34
 
171
 length:                - length of the list
 
172
 minLength:             - minimal length of the list
 
173
 maxLength:             - maximal length of the list
 
174
 enumeration:           - can be used to specify values that the list may have
 
175
 pattern:               - can be used to specify values that the list may have
 
176
 
 
177
xsd:union
 
178
---------
 
179
<xsd:simpleType name="typename">
 
180
  <xsd:union memberTypes="type1 type2 type3 ..."/>
 
181
</xsd:simpleType>
 
182
 
 
183
 * ������� ⨯ ��� ��ꥤ������ ⨯��
 
184
 
 
185
 
 
186
���᫥�������
 
187
-------------
 
188
<xsd:complexType name="children">
 
189
 <xsd:complexContent>
 
190
  <xsd:extension base="parrent">
 
191
   <xsd:sequence>
 
192
        ... adding new elements ...
 
193
 
 
194
  <xsd:restriction base="parrent">
 
195
   <xsd:sequence>
 
196
        ... changing/adding restrictions of base class ...
 
197
        ( All elements of base class must been repeated )
 
198
 
 
199
����饭�� ��᫥�������:
 
200
  <xsd:complexType name="..." final="#all" ...>
 
201
        final="#all"         - ����饭�� ��� ��᫥�������
 
202
        final="restriction"  - ����饭�� ��᫥������� � ������� xsd:resriction
 
203
        final="extension"    - ����饭�� ��᫥������� � ������� xsd:extension
 
204
 
 
205
 
 
206
Substitution
 
207
------------
 
208
<xsd:element name="hell"/>
 
209
<xsd:element name="inferno" substitutionGroup="hell"/>
 
210
 
 
211
 ��।��塞 �����������塞� ��������
 
212
 * ������ ���� �������묨
 
213
 * ������ ����� ��������� ⨯ (��� "inferno" ������ ����� ⨯�� ��᫥�����
 
214
   ⨯� "hell")
 
215
 * �� �� ������� ᢮� substitution:
 
216
        <xsd:element block="substitution" ... /> 
 
217
 * Substitution are transitive, but non-symetric ( i.e. A->B->C then A->C,
 
218
   but if B subsitute A, it is not the case that element A can substitute
 
219
   for B.
 
220
 
 
221
���ਡ���
 
222
---------
 
223
<xsd:complexType>
 
224
 <xsd:sequence> ... </xsd:sequence>
 
225
 <xsd:attributeGroup ref="name"/>               �� ��� inline
 
226
</xsd:complexType>
 
227
 
 
228
<xsd:attributeGroup name="name">
 
229
 <xsd:attribute name="attr_name" use="required">
 
230
        ... may be xsd:simpleType ...
 
231
 </xsd:attribute>
 
232
 ... ��㣨� ���ਡ��� ...
 
233
 <xsd:any minOccurs="0"/>               ���⢥����� �ந����쭮�� ���ਡ���
 
234
</xsd:attributeGroup>
 
235
 
 
236
 * ���ਡ��� ������ ��।������� ��᫥ ��।������ ��� ���㧫��
 
237
 * � ��砥 inline ����祭�� ���ਡ�⮢, xsd:attributeGroup ������ 㪠�뢠��,
 
238
   ���� �� ��।� ���������� xsd:attribute
 
239
 
 
240
 ��ࠬ���� xsd:attribute
 
241
   use="required"               ��易⥫�� ��ਡ�� (�� ࠡ�⠥� ��� ���������
 
242
                                ������権)
 
243
                                required - ��易⥫��
 
244
                                optional - �� ��易⥫�� (default)
 
245
                                prohibited - ����饭��
 
246
   default="value"              ���祭�� �� 㬠�砭��
 
247
   fixed="value"                �. element
 
248
   type="type"                  ��� ���ਡ�� (��� �������� ����� � �������
 
249
                                xsd:simpleType)
 
250
 ��ࠬ���� xsd:all
 
251
   namespace="..."              '##targetNamespace' - allows new attribute
 
252
                                provided from then namespace that the schema
 
253
                                is defining
 
254
                                '##any' - allow any attribute (default)
 
255
                                '##local' - allow any unqualified attributes
 
256
��㯯�஢�� ������⮢
 
257
---------------------
 
258
<xsd:group name="group_name">
 
259
 <xsd:sequence>
 
260
  ... elements declarations
 
261
 </xsd:sequence>
 
262
</xsd:group>
 
263
 
 
264
xsd:choice
 
265
----------
 
266
<xsd:complexType>
 
267
 <xsd:sequence>...</xsd:sequence>               ��樮���쭮
 
268
 <xsd:choice>
 
269
  ... elements declarations ...
 
270
 </xsd:choice>
 
271
</xsd:complexType>
 
272
 
 
273
 XML ॠ������ ������ �㤥� ᮤ�ঠ�� ����(�� ����� � �� �����) �� 㪠������
 
274
 ������⮢
 
275
 
 
276
xsd:any
 
277
-------
 
278
<xsl:sequence>
 
279
        <xsl:element .... >
 
280
        ....
 
281
        <xsd:any minOccurs="0"/>
 
282
</xsl:sequence>
 
283
 
 
284
 * xsd:any ᮮ⢥����� ��᮫�⭮ �ந����쭮�� ��������
 
285
 
 
286
xsd:all
 
287
-------
 
288
 ���⠪�� ��� � xsd:choice, �蠥� �஡����, ����� ���㧫� ����� ��� � 
 
289
 �ந����쭮� ���浪�
 
290
 
 
291
 
 
292
����樨
 
293
--------
 
294
<xsd:anotation>
 
295
  <xsd:documentation> Anotation </xsd:documentation>
 
296
</xsd:anotation>
 
297
 
 
298
 ��ࠬ���� xsd:documentation:
 
299
   source="URI"         ���� ⥪�� ���
 
300
   xml:lang="US"        Codepage
 
301
 
 
302
 * ����� ���� ⮫쪮 ����! ���㧫�� xsd:element
 
303
 
 
304
 
 
305
Including in xml document
 
306
-------------------------
 
307
<?xml version="1.0"?>
 
308
<RootItem xmlns="something"             (Specifiying default namespace, must 
 
309
                                        corespond to value specified in .xsd
 
310
                                        file)
 
311
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 
312
          xsi:schemaLocation="targetNamespace   (�������� � .xsd file)
 
313
                             .xsd file">
 
314
 
 
315
 * ����� �஢����� �� ᮮ⢥��⢨� ��᪮�쪨� �奬��:
 
316
          xsi:schemaLocation="targetNamespace
 
317
                             .xsd file
 
318
                              targetNamespace2
 
319
                             .xsd file2">
 
320
 
 
321
Notes
 
322
-----
 
323
* MinOccur & MaxOccur may be used only in nested element declaration
 
 
b'\\ No newline at end of file'