xsd 2.9.3 → 2.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/sig/xsd.rbs ADDED
@@ -0,0 +1,1071 @@
1
+ # Signatures of the gem, from `rbs prototype rb` of lib/ and refined by hand. The readers that
2
+ # BaseObject's `property`, `child` and `link` define are in xsd_members.rbs, generated: `rake rbs:members`.
3
+ module XSD
4
+ # Base object
5
+ class BaseObject
6
+ self.@properties: untyped
7
+
8
+ self.@links: untyped
9
+
10
+ self.@children: untyped
11
+
12
+ self.@member_readers: untyped
13
+
14
+ self.@mapped_name: untyped
15
+
16
+ @options: untyped
17
+
18
+ @cache: untyped
19
+
20
+ # the parent may be a document or a node of a foreign schema (e.g. wsdl:types), there is no object for those
21
+ @parent: untyped
22
+
23
+ @documentation: untyped
24
+
25
+ @collect_elements: untyped
26
+
27
+ @collect_attributes: untyped
28
+
29
+ attr_reader options: untyped
30
+
31
+ # Objects that can not have nested elements
32
+ NO_ELEMENTS_CONTAINER: ::Array[:annotation | :simpleType | :attributeGroup | :attribute | :unique | :union | :simpleContent | :list | :any | :anyAttribute | :key | :keyref]
33
+
34
+ # Objects that cannot have nested attributes
35
+ NO_ATTRIBUTES_CONTAINER: ::Array[:annotation | :unique | :anyAttribute | :all | :attribute | :choice | :sequence | :group | :simpleType | :facet | :key | :keyref]
36
+
37
+ # Base XMLSchema namespace
38
+ XML_SCHEMA: "http://www.w3.org/2001/XMLSchema"
39
+
40
+ # Namespace map used for all internal xpath queries
41
+ XML_SCHEMA_NS: { "xs" => untyped }
42
+
43
+ def self.properties: () -> untyped
44
+
45
+ def self.links: () -> untyped
46
+
47
+ def self.children: () -> untyped
48
+
49
+ def initialize: (?::Hash[untyped, untyped] options) -> void
50
+
51
+ # Get current XML node
52
+ # @return Nokogiri::XML::Node
53
+ def node: () -> untyped
54
+
55
+ # Get object string representation
56
+ # @return String
57
+ def inspect: () -> ::String
58
+
59
+ # Optional. Specifies a unique ID for the element
60
+ # @!attribute id
61
+ # @return String
62
+ # property :id, :string
63
+ def id: () -> untyped
64
+
65
+ # Get current namespaces
66
+ # @return Hash
67
+ def namespaces: () -> untyped
68
+
69
+ # Get child nodes
70
+ # @param [Symbol] name
71
+ # @param [Boolean] deep
72
+ # @return Nokogiri::XML::NodeSet
73
+ def nodes: (?::Symbol name, ?bool deep) -> untyped
74
+
75
+ # Get schemas by namespace or prefix
76
+ # @param [String, nil] ns_or_prefix
77
+ # @return Array<Schema>
78
+ def schemas_for_namespace: (untyped ns_or_prefix) -> untyped
79
+
80
+ # Get element or attribute by path
81
+ # @return Element, Attribute, nil
82
+ def []: (*untyped args) -> untyped
83
+
84
+ # Search node by name in all available schemas and return its object
85
+ # @param [Symbol] node_name
86
+ # @param [String] name
87
+ # @return BaseObject, nil
88
+ def object_by_name: (untyped node_name, untyped name) -> (nil | untyped)
89
+
90
+ # Get reader object for node
91
+ # @param [Nokogiri::XML::Node] node
92
+ # @return BaseObject
93
+ def node_to_object: (untyped node) -> untyped
94
+
95
+ # Get xml parent object
96
+ # @return BaseObject, nil
97
+ def parent: () -> untyped
98
+
99
+ # Get current schema object
100
+ # @return Schema
101
+ def schema: () -> untyped
102
+
103
+ # Get child objects
104
+ # @param [Symbol] name
105
+ # @return Array<BaseObject>
106
+ def map_children: (untyped name) -> untyped
107
+
108
+ # Get child object
109
+ # @param [Symbol] name
110
+ # @return BaseObject, nil
111
+ def map_child: (untyped name) -> untyped
112
+
113
+ # Strip namespace prefix from node name
114
+ # @param [String, nil] name Name to strip from
115
+ # @return String, nil
116
+ def strip_prefix: (untyped name) -> untyped
117
+
118
+ # Get namespace prefix from node name
119
+ # @param [String, nil] name Name to strip from
120
+ # @return String, nil
121
+ def get_prefix: (untyped name) -> (untyped | nil)
122
+
123
+ # Return element documentation
124
+ # @return Array<String>
125
+ def documentation: () -> untyped
126
+
127
+ # Return documentation for specified node
128
+ # @param [Nokogiri::XML::Node] node
129
+ # @return Array<String>
130
+ def documentation_for: (untyped node) -> untyped
131
+
132
+ # Get all available elements on the current stack level
133
+ # @return Array<Element>
134
+ def collect_elements: (*untyped) -> untyped
135
+
136
+ # Get all available attributes on the current stack level
137
+ # @return Array<Attribute>
138
+ def collect_attributes: (*untyped) -> untyped
139
+
140
+ # Get reader instance
141
+ # @return XML
142
+ def reader: () -> untyped
143
+
144
+ def self.to_underscore: (untyped string) -> untyped
145
+
146
+ # Define new object property
147
+ # @param [Symbol] name
148
+ # @param [Symbol] type
149
+ # @param [Hash] options
150
+ def self.property: (untyped name, untyped type, ?::Hash[untyped, untyped] options) { (?) -> untyped } -> untyped
151
+
152
+ # Define new object child
153
+ # @param [Symbol] name
154
+ # @param [Symbol, Array<Symbol>] type
155
+ # @param [Hash] options
156
+ def self.child: (untyped name, untyped type, ?::Hash[untyped, untyped] options) -> untyped
157
+
158
+ # Define new object child
159
+ # @param [Symbol] name
160
+ # @param [Symbol] type
161
+ # @param [Hash] options
162
+ def self.link: (untyped name, untyped type, ?::Hash[untyped, untyped] options) -> untyped
163
+
164
+ # A property, link or child is read through a method of its own: reaching it through method_missing costs far
165
+ # more per call, and an object is asked for its members all the time. The method goes in a module of the class's
166
+ # own, so that a method the class defines itself still wins, and is not defined where a method of that name
167
+ # exists already — an ancestor's own keeps answering, as it did when the name went to method_missing.
168
+ # @param [Symbol] method
169
+ def self.define_member_reader: (untyped method) -> (nil | untyped)
170
+
171
+ # The module a class's member readers are defined in
172
+ # @return Module
173
+ def self.member_readers: () -> untyped
174
+
175
+ # What #read_member answers when the name is none of the object's members
176
+ NOT_A_MEMBER: untyped
177
+
178
+ # Lookup for properties
179
+ # @param [Symbol] method
180
+ # @param [Array] args
181
+ def method_missing: (untyped method, *untyped args) -> untyped
182
+
183
+ # The value of a property, link or child, cached: from the node, through a reference, or by its name in the
184
+ # schemas. A member reader and method_missing both come here.
185
+ # @param [Symbol] method
186
+ # @param [Array] args
187
+ # @return Object, NOT_A_MEMBER
188
+ def read_member: (untyped method, untyped args) -> untyped
189
+
190
+ # Does object has property/link/child?
191
+ # @param [Symbol] method
192
+ # @param [Boolean] include_private
193
+ def respond_to_missing?: (untyped method, ?bool include_private) -> untyped
194
+
195
+ # Get mapped element name
196
+ # @return Symbol
197
+ def self.mapped_name: () -> untyped
198
+
199
+ # Return string if it is not empty, or nil otherwise
200
+ # @param [String, nil] string
201
+ # @return String, nil
202
+ def nil_if_empty: (untyped string) -> (nil | untyped)
203
+
204
+ private
205
+
206
+ # Resolve property value from the node attribute, resolver block, reference or default
207
+ # @param [Hash] property
208
+ # @param [Symbol] method
209
+ # @param [Array] args
210
+ def property_value: (untyped property, untyped method, untyped args) -> untyped
211
+
212
+ # Cast raw attribute value to the declared property type
213
+ # @param [Hash] property
214
+ # @param [String] value
215
+ def cast_property_value: (untyped property, untyped value) -> untyped
216
+
217
+ def definition_match?: (untyped definition, untyped query) -> (false | untyped)
218
+ end
219
+ end
220
+
221
+ module XSD
222
+ class Error < StandardError
223
+ end
224
+
225
+ class ValidationError < Error
226
+ end
227
+
228
+ class ImportError < Error
229
+ end
230
+ end
231
+
232
+ module XSD
233
+ # The all element specifies that the child elements can appear in any order and that each child element can
234
+ # occur zero or one time.
235
+ # Parent elements: group, complexType, restriction (both simpleContent and complexContent),
236
+ # extension (both simpleContent and complexContent)
237
+ # https://www.w3schools.com/xml/el_all.asp
238
+ class All < BaseObject
239
+ include MinMaxOccurs
240
+
241
+ include ElementContainer
242
+ end
243
+ end
244
+
245
+ module XSD
246
+ # The annotation element is a top level element that specifies schema comments. The comments serve as inline
247
+ # documentation.
248
+ # Parent elements: Any element
249
+ # https://www.w3schools.com/xml/el_annotation.asp
250
+ class Annotation < BaseObject
251
+ end
252
+ end
253
+
254
+ module XSD
255
+ # The any element enables the author to extend the XML document with elements not specified by the schema.
256
+ # Parent elements: choice, sequence
257
+ # https://www.w3schools.com/xml/el_any.asp
258
+ class Any < BaseObject
259
+ include MinMaxOccurs
260
+
261
+ # Get virtual element name
262
+ # @return String
263
+ def name: () -> "#any"
264
+ end
265
+ end
266
+
267
+ module XSD
268
+ # The anyAttribute element enables the author to extend the XML document with attributes not specified by the schema.
269
+ # Parent elements: complexType, restriction (both simpleContent and complexContent), extension (both simpleContent
270
+ # and complexContent), attributeGroup
271
+ # https://www.w3schools.com/xml/el_anyattribute.asp
272
+ class AnyAttribute < BaseObject
273
+ # Get virtual attribute name
274
+ # @return String
275
+ def name: () -> "#anyAttribute"
276
+ end
277
+ end
278
+
279
+ module XSD
280
+ # The appinfo element specifies information to be used by the application.
281
+ # Parent elements: annotation
282
+ # https://www.w3schools.com/xml/el_appinfo.asp
283
+ class Appinfo < BaseObject
284
+ end
285
+ end
286
+
287
+ module XSD
288
+ # The attribute element defines an attribute.
289
+ # Parent elements: attributeGroup, schema, complexType, restriction (both simpleContent and complexContent),
290
+ # extension (both simpleContent and complexContent)
291
+ # https://www.w3schools.com/xml/el_attribute.asp
292
+ class Attribute < BaseObject
293
+ prepend CachedDataType
294
+
295
+ TYPE_PROPERTY: :type
296
+
297
+ include SimpleTyped
298
+
299
+ include Referenced
300
+
301
+ include Named
302
+
303
+ # Determine if attribute is required
304
+ # @return Boolean
305
+ def required?: () -> untyped
306
+
307
+ # Determine if attribute is optional
308
+ # @return Boolean
309
+ def optional?: () -> untyped
310
+
311
+ # Determine if attribute is prohibited
312
+ # @return Boolean
313
+ def prohibited?: () -> untyped
314
+
315
+ # Get base data type
316
+ # @return String, nil
317
+ def data_type: () -> untyped
318
+ end
319
+ end
320
+
321
+ module XSD
322
+ # The attributeGroup element is used to group a set of attribute declarations so that they can be incorporated as a
323
+ # group into complex type definitions.
324
+ # Parent elements: attributeGroup, complexType, schema, restriction (both simpleContent and complexContent),
325
+ # extension (both simpleContent and complexContent
326
+ # https://www.w3schools.com/xml/el_attributegroup.asp
327
+ class AttributeGroup < BaseObject
328
+ include Referenced
329
+
330
+ include AttributeContainer
331
+
332
+ include Named
333
+ end
334
+ end
335
+
336
+ module XSD
337
+ # XML Schema choice element allows only one of the elements contained in the <choice> declaration to be present
338
+ # within the containing element.
339
+ # Parent elements: group, choice, sequence, complexType, restriction (both simpleContent and complexContent),
340
+ # extension (both simpleContent and complexContent)
341
+ # https://www.w3schools.com/xml/el_choice.asp
342
+ class Choice < BaseObject
343
+ include MinMaxOccurs
344
+
345
+ include ElementContainer
346
+ end
347
+ end
348
+
349
+ module XSD
350
+ # The complexContent element defines extensions or restrictions
351
+ # on a complex type that contains mixed content or elements only.
352
+ # Parent elements: complexType
353
+ # https://www.w3schools.com/xml/el_complexcontent.asp
354
+ class ComplexContent < BaseObject
355
+ end
356
+ end
357
+
358
+ module XSD
359
+ # The complexType element defines a complex type. A complex type element is an XML element that contains other
360
+ # elements and/or attributes.
361
+ # Parent elements: element, redefine, schema
362
+ # https://www.w3schools.com/xml/el_complextype.asp
363
+ class ComplexType < BaseObject
364
+ prepend CachedDataType
365
+
366
+ include AttributeContainer
367
+
368
+ include Named
369
+
370
+ # Determine if this is a linked type
371
+ # @return Boolean
372
+ def linked?: () -> untyped
373
+
374
+ # Determine if this type has mixed content definition
375
+ # @return Boolean
376
+ def mixed_content?: () -> (true | untyped | false)
377
+
378
+ # Determine if this type has complex content definition
379
+ # @return Boolean
380
+ def complex_content?: () -> (false | true | untyped)
381
+
382
+ # Determine if this type has simple content definition
383
+ # @return Boolean
384
+ def simple_content?: () -> untyped
385
+
386
+ # Get simple content data type
387
+ # @return String, nil
388
+ def data_type: () -> (nil | untyped)
389
+
390
+ private
391
+
392
+ # Get data type of an extension/restriction base type
393
+ # @param [Extension, Restriction, nil] derivation
394
+ # @return String, nil
395
+ def base_data_type: (untyped derivation) -> (nil | untyped)
396
+ end
397
+ end
398
+
399
+ module XSD
400
+ # The documentation element is used to enter text comments in a schema.
401
+ # Parent elements: annotation
402
+ # https://www.w3schools.com/xml/el_documentation.asp
403
+ class Documentation < BaseObject
404
+ end
405
+ end
406
+
407
+ module XSD
408
+ # The element element defines an element.
409
+ # Parent elements: schema, choice, all, sequence, group
410
+ # https://www.w3schools.com/xml/el_element.asp
411
+ class Element < BaseObject
412
+ @substitutable_elements: untyped
413
+
414
+ prepend CachedDataType
415
+
416
+ TYPE_PROPERTY: :type
417
+
418
+ include MinMaxOccurs
419
+
420
+ include SimpleTyped
421
+
422
+ include ComplexTyped
423
+
424
+ include Referenced
425
+
426
+ include Named
427
+
428
+ # Determine if element is required
429
+ # @return Boolean
430
+ def required?: () -> untyped
431
+
432
+ # Determine if element is optional
433
+ # @return Boolean
434
+ def optional?: () -> untyped
435
+
436
+ # Determine if element has complex content
437
+ # @return Boolean
438
+ def complex_content?: () -> untyped
439
+
440
+ # Determine if element has simple content
441
+ # @return Boolean
442
+ def simple_content?: () -> (untyped | true)
443
+
444
+ # Determine if element has attributes
445
+ # @return Boolean
446
+ def attributes?: () -> untyped
447
+
448
+ # Determine if element has mixed content
449
+ # @return Boolean
450
+ def mixed_content?: () -> untyped
451
+
452
+ # Get substitutable elements
453
+ # @return Array<Element>
454
+ def substitutable_elements: () -> untyped
455
+
456
+ # Check is this attribute is global (immediate child of schema element)
457
+ # @return Boolean
458
+ def global?: () -> untyped
459
+
460
+ # Get base data type
461
+ # @return String, nil
462
+ def data_type: () -> untyped
463
+ end
464
+ end
465
+
466
+ module XSD
467
+ # The extension element extends an existing simpleType or complexType element.
468
+ # Parent elements: simpleContent, complexContent
469
+ # https://www.w3schools.com/xml/el_extension.asp
470
+ class Extension < BaseObject
471
+ TYPE_PROPERTY: nil
472
+
473
+ include Based
474
+
475
+ include AttributeContainer
476
+ end
477
+ end
478
+
479
+ module XSD
480
+ # Virtual object for all restriction facets
481
+ # Parent elements: restriction
482
+ class Facet < BaseObject
483
+ end
484
+ end
485
+
486
+ module XSD
487
+ # The field element specifies an XPath expression that specifies the value used to define an identity constraint.
488
+ # Parent elements: key, keyref, unique
489
+ # https://www.w3schools.com/xml/el_field.asp
490
+ class Field < BaseObject
491
+ end
492
+ end
493
+
494
+ module XSD
495
+ # The group element is used to define a group of elements to be used in complex type definitions.
496
+ # Parent elements: schema, choice, sequence, complexType, restriction (both simpleContent and complexContent),
497
+ # extension (both simpleContent and complexContent)
498
+ # https://www.w3schools.com/xml/el_group.asp
499
+ class Group < BaseObject
500
+ include MinMaxOccurs
501
+
502
+ include Referenced
503
+
504
+ include Named
505
+ end
506
+ end
507
+
508
+ module XSD
509
+ # The import element is used to add multiple schemas with different target namespace to a document.
510
+ # Parent elements: schema
511
+ # https://www.w3schools.com/xml/el_import.asp
512
+ class Import < BaseObject
513
+ # Get imported schema: the one at the import's location when that one is loaded already; otherwise one known for
514
+ # the namespace, added manually or by another import. Not for the absent namespace: schemas with no target
515
+ # namespace are each a schema of its own (a provider's documents, every one with its own copies of the common
516
+ # types), so every import of it is read from its own location.
517
+ # @return Schema
518
+ def imported_schema: () -> untyped
519
+ end
520
+ end
521
+
522
+ module XSD
523
+ # The include element is used to add multiple schemas with the same target namespace to a document.
524
+ # Parent elements: schema
525
+ # https://www.w3schools.com/xml/el_include.asp
526
+ class Include < BaseObject
527
+ # Get included schema
528
+ # @return Schema
529
+ def imported_schema: () -> untyped
530
+ end
531
+ end
532
+
533
+ module XSD
534
+ # The unique element defines that an element or an attribute value must be unique within the scope.
535
+ # Parent elements: element
536
+ # https://www.w3schools.com/xml/el_unique.asp
537
+ class Key < BaseObject
538
+ end
539
+ end
540
+
541
+ module XSD
542
+ # The unique element defines that an element or an attribute value must be unique within the scope.
543
+ # Parent elements: element
544
+ # https://www.w3schools.com/xml/el_unique.asp
545
+ class Keyref < BaseObject
546
+ end
547
+ end
548
+
549
+ module XSD
550
+ # The list element defines a simple type element as a list of values of a specified data type.
551
+ # Parent elements: simpleType
552
+ # https://www.w3schools.com/xml/el_list.asp
553
+ class List < BaseObject
554
+ TYPE_PROPERTY: :item_type
555
+
556
+ include SimpleTyped
557
+ end
558
+ end
559
+
560
+ module XSD
561
+ # The restriction element defines restrictions on a simpleType, simpleContent, or complexContent definition.
562
+ # Parent elements: simpleType, simpleContent, complexContent
563
+ # https://www.w3schools.com/xml/el_restriction.asp
564
+ class Restriction < BaseObject
565
+ @facets: untyped
566
+
567
+ TYPE_PROPERTY: nil
568
+
569
+ include Based
570
+
571
+ include SimpleTyped
572
+
573
+ include AttributeContainer
574
+
575
+ FACET_ELEMENTS: ::Array["minExclusive" | "minInclusive" | "maxExclusive" | "maxInclusive" | "totalDigits" | "fractionDigits" | "length" | "minLength" | "maxLength" | "enumeration" | "whiteSpace" | "pattern"]
576
+
577
+ # Get restriction facets
578
+ # @return Hash
579
+ def facets: () -> untyped
580
+
581
+ # Get all available elements on the current stack level, optionally including base type elements
582
+ # @param [Boolean] include_base
583
+ # @return Array<Element>
584
+ def collect_elements: (?bool include_base) -> untyped
585
+
586
+ # Get all available attributes on the current stack level, optionally including base type attributes
587
+ # @param [Boolean] include_base
588
+ # @return Array<Attribute>
589
+ def collect_attributes: (?bool include_base) -> untyped
590
+ end
591
+ end
592
+
593
+ module XSD
594
+ # The schema element defines the root element of a schema.
595
+ # Parent elements: NONE
596
+ # https://www.w3schools.com/xml/el_schema.asp
597
+ class Schema < BaseObject
598
+ @object_cache: untyped
599
+
600
+ @declaration_nodes: untyped
601
+
602
+ @target_namespace_prefix: untyped
603
+
604
+ @namespace_prefix: untyped
605
+
606
+ include AttributeContainer
607
+
608
+ include ElementContainer
609
+
610
+ # Get current schema object
611
+ # @return Schema
612
+ def schema: () -> self
613
+
614
+ # Target namespace of the schema. For a chameleon view (see XML#chameleon), the namespace of the schema
615
+ # that includes it — the one everything it declares belongs to.
616
+ # @return String, nil
617
+ def target_namespace: () -> untyped
618
+
619
+ # Is this a schema with no target namespace, seen as part of the namespace of a schema including it?
620
+ # @return Boolean
621
+ def chameleon?: () -> untyped
622
+
623
+ # The schema a chameleon view is a view of
624
+ # @return Schema, nil
625
+ def chameleon_source: () -> untyped
626
+
627
+ # Objects made of this schema's nodes. A chameleon view keeps its own: the same node is a different
628
+ # definition in each namespace that includes it.
629
+ # @return Hash
630
+ def object_cache: () -> untyped
631
+
632
+ # The node of a top-level declaration of this schema, by its kind and name — what a reference by name looks up
633
+ # (BaseObject#object_by_name). The children are indexed in one pass on the first lookup: a query per lookup
634
+ # scans all of them again, and a large schema is looked up in once for every reference to it.
635
+ # @param [Symbol, String] node_name kind of declaration: complexType, simpleType, element, group, ...
636
+ # @param [String] name local name
637
+ # @return Nokogiri::XML::Element, nil
638
+ def declaration_node: (untyped node_name, untyped name) -> untyped
639
+
640
+ # This schema and every schema it includes, those included in turn too
641
+ # @return Array<Schema>
642
+ def with_includes: () -> untyped
643
+
644
+ # Get all available elements on the current stack level, for schema same as elements
645
+ # @return Array<Element>
646
+ def collect_elements: (*untyped) -> untyped
647
+
648
+ # Get all available attributes on the current stack level, for schema same as attributes
649
+ # @return Array<Attribute>
650
+ def collect_attributes: (*untyped) -> untyped
651
+
652
+ # Get target namespace prefix
653
+ # @return String, nil
654
+ def target_namespace_prefix: () -> untyped
655
+
656
+ # Get schema namespace prefix
657
+ # @return String, nil
658
+ def namespace_prefix: () -> untyped
659
+
660
+ # Location the schema was read from, used to resolve relative import/include locations
661
+ # @return String, nil
662
+ def location: () -> untyped
663
+
664
+ # Check if namespace is a target namespace
665
+ # @param [String, nil] namespace
666
+ # @return Boolean
667
+ def targets_namespace?: (untyped namespace) -> untyped
668
+
669
+ # Override map_children on schema to get objects from all loaded schemas
670
+ # @param [Symbol] name
671
+ # @param [Hash] cache Schema nodes already visited, guards against import/include cycles
672
+ # @return Array<BaseObject>
673
+ def map_children: (untyped name, ?untyped cache) -> untyped
674
+
675
+ # Get children from all loaded schemas
676
+ # @param [Symbol] name
677
+ # @param [Hash] cache
678
+ # @return Array<BaseObject>
679
+ def import_map_children: (untyped name, untyped cache) -> (::Array[untyped] | untyped)
680
+
681
+ # Get import by namespace or prefix
682
+ # @param [String, nil] ns_or_prefix
683
+ # @return Import
684
+ def import_by_namespace: (untyped ns_or_prefix) -> untyped
685
+
686
+ # Validate XML against current schema
687
+ # @param [String, Pathname, Nokogiri::XML::Document] xml
688
+ def validate_xml: (untyped xml) -> untyped
689
+
690
+ # Validate current schema against XMLSchema 1.0
691
+ def validate: () -> untyped
692
+
693
+ private
694
+
695
+ # Get Nokogiri::XML::Schema object to validate against
696
+ # @return Nokogiri::XML::Schema
697
+ def schema_validator: () -> untyped
698
+
699
+ # Write the schema and all of its imports/includes as a flat set of files with rewritten locations
700
+ # @param [Schema] schema
701
+ # @param [Hash] processed Maps already written schema nodes to generated file names
702
+ # @return String Name of the file the schema was written to
703
+ def recursive_import_xsd: (untyped schema, untyped processed) { (?) -> untyped } -> untyped
704
+
705
+ # Get a detached copy of the schema node with all inherited namespaces declared on it
706
+ # @param [Schema] schema
707
+ # @return Nokogiri::XML::Node
708
+ def schema_node_with_namespaces: (untyped schema) -> untyped
709
+
710
+ # Create Nokogiri XML Schema instance with preconfigured options
711
+ # @param [IO, String] io
712
+ def create_xml_schema: (untyped io) -> untyped
713
+ end
714
+ end
715
+
716
+ module XSD
717
+ # The selector element specifies an XPath expression that selects a set of elements for an identity constraint
718
+ # (unique, key, and keyref elements).
719
+ # Parent elements: key, keyref, unique
720
+ # https://www.w3schools.com/xml/el_selector.asp
721
+ class Selector < BaseObject
722
+ end
723
+ end
724
+
725
+ module XSD
726
+ # The sequence element specifies that the child elements must appear in a sequence.
727
+ # Each child element can occur from 0 to any number of times.
728
+ # Parent elements: group, choice, sequence, complexType, restriction (both simpleContent and complexContent),
729
+ # extension (both simpleContent and complexContent)
730
+ # https://www.w3schools.com/xml/el_sequence.asp
731
+ class Sequence < BaseObject
732
+ include MinMaxOccurs
733
+
734
+ include ElementContainer
735
+ end
736
+ end
737
+
738
+ module XSD
739
+ # The simpleContent element contains extensions or restrictions on a text-only complex type or on a simple type as
740
+ # content and contains no elements.
741
+ # Parent elements: complexType
742
+ # https://www.w3schools.com/xml/el_simpleContent.asp
743
+ class SimpleContent < BaseObject
744
+ end
745
+ end
746
+
747
+ module XSD
748
+ # The simpleType element defines a simple type and specifies the constraints and information about the values
749
+ # of attributes or text-only elements.
750
+ # Parent elements: attribute, element, list, restriction, schema, union
751
+ # https://www.w3schools.com/xml/el_simpletype.asp
752
+ class SimpleType < BaseObject
753
+ include Named
754
+
755
+ prepend CachedDataType
756
+
757
+ # Determine if this is a linked type
758
+ # @return Boolean
759
+ def linked?: () -> untyped
760
+
761
+ # Get base data type
762
+ # @return String, nil
763
+ def data_type: () -> (untyped | untyped | "string")
764
+ end
765
+ end
766
+
767
+ module XSD
768
+ # The union element defines a simple type as a collection (union) of values from specified simple data types.
769
+ # Parent elements: simpleType
770
+ # https://www.w3schools.com/xml/el_union.asp
771
+ class Union < BaseObject
772
+ @types: untyped
773
+
774
+ # Nested simple and built-in types
775
+ # @return Array<SimpleType, String>
776
+ def types: () -> untyped
777
+ end
778
+ end
779
+
780
+ module XSD
781
+ # The unique element defines that an element or an attribute value must be unique within the scope.
782
+ # Parent elements: element
783
+ # https://www.w3schools.com/xml/el_unique.asp
784
+ class Unique < BaseObject
785
+ end
786
+ end
787
+
788
+ module XSD
789
+ module AttributeContainer
790
+ # Nested attribute groups
791
+ # @!attribute attribute_groups
792
+ # @return Array<AttributeGroup>
793
+ def self.included: (untyped obj) -> untyped
794
+ end
795
+ end
796
+
797
+ module XSD
798
+ # Used by extension and restriction elements
799
+ module Based
800
+ # Base simpleType
801
+ # @!attribute base_simple_type
802
+ # @return SimpleType, nil
803
+ def self.included: (untyped obj) -> untyped
804
+
805
+ # Get all available elements on the current stack level, optionally including base type elements
806
+ # @param [Boolean] include_base
807
+ # @return Array<Element>
808
+ def collect_elements: (?bool include_base) -> untyped
809
+
810
+ # Get all available attributes on the current stack level, optionally including base type attributes
811
+ # @param [Boolean] include_base
812
+ # @return Array<Attribute>
813
+ def collect_attributes: (?bool include_base) -> untyped
814
+ end
815
+ end
816
+
817
+ module XSD
818
+ # A definition's data type follows from the schema, which does not change once read: it is worked out on first use
819
+ # and kept. Reading XML casts every value by it, so it is asked for once per value otherwise.
820
+ module CachedDataType
821
+ @data_type: untyped
822
+
823
+ def data_type: () -> untyped
824
+ end
825
+ end
826
+
827
+ module XSD
828
+ # Provides object an ability to have complex type (nested or linked)
829
+ module ComplexTyped
830
+ # Child/linked complex type
831
+ # @!attribute complex_type
832
+ # @return ComplexType, nil
833
+ def self.included: (untyped obj) -> untyped
834
+
835
+ # Get all available elements on the current stack level or linked type elements
836
+ # @param [Boolean] linked_type
837
+ # @return Array<Element>
838
+ def collect_elements: (?bool linked_type) -> untyped
839
+
840
+ # Get all available attributes on the current stack level or linked type attributes
841
+ # @param [Boolean] linked_type
842
+ # @return Array<Attribute>
843
+ def collect_attributes: (?bool linked_type) -> untyped
844
+ end
845
+ end
846
+
847
+ module XSD
848
+ module ElementContainer
849
+ # Nested elements
850
+ # @!attribute elements
851
+ # @return Array<Element>
852
+ def self.included: (untyped obj) -> untyped
853
+ end
854
+ end
855
+
856
+ module XSD
857
+ module MinMaxOccurs
858
+ @computed_max_occurs: untyped
859
+
860
+ @computed_min_occurs: untyped
861
+
862
+ # Optional. Specifies the maximum number of times the choice element can occur in the parent element.
863
+ # The value can be any number >= 0, or if you want to set no limit on the maximum number, use the value "unbounded".
864
+ # Default value is 1
865
+ # @!attribute max_occurs
866
+ # @return Integer, Symbol
867
+ def self.included: (untyped obj) -> untyped
868
+
869
+ # Compute actual max_occurs accounting parents
870
+ # @return Integer, Symbol
871
+ def computed_max_occurs: () -> untyped
872
+
873
+ # Compute actual min_occurs accounting parents
874
+ # @return Integer
875
+ def computed_min_occurs: () -> untyped
876
+
877
+ # Determine if element may occur multiple times
878
+ # @return Boolean
879
+ def multiple?: () -> untyped
880
+
881
+ # Determine if element may occur multiple times, accounting parents
882
+ # @return Boolean
883
+ def multiple_allowed?: () -> untyped
884
+ end
885
+ end
886
+
887
+ module XSD
888
+ module Named
889
+ @namespace: untyped
890
+
891
+ # Get definition namespace
892
+ # @return String
893
+ def namespace: () -> untyped
894
+
895
+ # Get absolute definition name
896
+ # @return String
897
+ def absolute_name: () -> (::String | nil)
898
+ end
899
+ end
900
+
901
+ module XSD
902
+ module Referenced
903
+ # Reference object
904
+ # @!attribute reference
905
+ # @return BaseObject
906
+ def self.included: (untyped obj) -> untyped
907
+
908
+ # Is object referenced?
909
+ # @return Boolean
910
+ def referenced?: () -> untyped
911
+ end
912
+ end
913
+
914
+ module XSD
915
+ # Provides object an ability to have simple type (nested or linked)
916
+ module SimpleTyped
917
+ # Get child/linked simple type
918
+ # @!attribute simple_type
919
+ # @return SimpleType, nil
920
+ def self.included: (untyped obj) -> untyped
921
+ end
922
+ end
923
+
924
+ module XSD
925
+ VERSION: "2.9.3"
926
+ end
927
+
928
+ module XSD
929
+ class XML
930
+ @options: untyped
931
+
932
+ # keyed by node identity, the parsed documents are treated as immutable
933
+ @object_cache: untyped
934
+
935
+ @schemas: untyped
936
+
937
+ @schemas_by_location: untyped
938
+
939
+ @chameleons: untyped
940
+
941
+ @default_logger: untyped
942
+
943
+ attr_reader options: untyped
944
+
945
+ attr_reader object_cache: untyped
946
+
947
+ attr_reader schemas: untyped
948
+
949
+ # Matches locations that have to be fetched over the network
950
+ REMOTE_LOCATION: ::Regexp
951
+
952
+ # Legacy resource resolver, kept for backwards compatibility. Resolves absolute paths and URLs only,
953
+ # relative locations are resolved by the reader itself, see #read_resource
954
+ DEFAULT_RESOURCE_RESOLVER: untyped
955
+
956
+ CLASS_MAP: { "schema" => untyped, "element" => untyped, "attribute" => untyped, "choice" => untyped, "complexType" => untyped, "sequence" => untyped, "simpleContent" => untyped, "complexContent" => untyped, "extension" => untyped, "import" => untyped, "include" => untyped, "simpleType" => untyped, "all" => untyped, "restriction" => untyped, "group" => untyped, "any" => untyped, "union" => untyped, "attributeGroup" => untyped, "list" => untyped, "unique" => untyped, "selector" => untyped, "field" => untyped, "annotation" => untyped, "documentation" => untyped, "appinfo" => untyped, "anyAttribute" => untyped, "key" => untyped, "keyref" => untyped, "minExclusive" => untyped, "minInclusive" => untyped, "maxExclusive" => untyped, "maxInclusive" => untyped, "totalDigits" => untyped, "fractionDigits" => untyped, "length" => untyped, "minLength" => untyped, "maxLength" => untyped, "enumeration" => untyped, "whiteSpace" => untyped, "pattern" => untyped }
957
+
958
+ # Create reader from a file path
959
+ # @param [String, Pathname] path
960
+ # @param [Hash] options
961
+ # @return XML
962
+ def self.open: (untyped path, **untyped options) -> untyped
963
+
964
+ def initialize: (**untyped options) -> void
965
+
966
+ def logger: () -> untyped
967
+
968
+ # Resolver used to fetch imported/included schemas
969
+ # @return Proc
970
+ def resource_resolver: () -> untyped
971
+
972
+ def tmp_dir: () -> untyped
973
+
974
+ def read_document: (untyped xml) -> untyped
975
+
976
+ # Add schema xml to reader instance
977
+ # @param [String] xml
978
+ # @param [String, nil] location Location the xml was read from, used to resolve relative imports
979
+ # @return Schema
980
+ def add_schema_xml: (untyped xml, ?location: untyped?) -> untyped
981
+
982
+ # Add schema node to reader instance
983
+ # @param [Nokogiri::XML::Node] node
984
+ # @param [String, nil] location Location the node was read from, used to resolve relative imports
985
+ # @return Schema
986
+ def add_schema_node: (untyped node, ?location: untyped?) -> untyped
987
+
988
+ # Load schema referenced by an import/include, reusing an already loaded one when possible.
989
+ #
990
+ # A location written with backslashes (`import\types.xsd`) is read as one written with slashes: a
991
+ # `schemaLocation` is a URI reference, where the separator is `/` alone, but schemas authored on Windows
992
+ # carry such locations, and the tools they were made with accept them. A custom resolver is handed the
993
+ # location so normalized.
994
+ # @param [String] location
995
+ # @param [String, nil] namespace
996
+ # @param [String, nil] base Location of the referencing schema
997
+ # @return Schema
998
+ def load_schema: (untyped location, ?namespace: untyped?, ?base: untyped?) -> untyped
999
+
1000
+ # The schema already read from a location, relative to a base as an import or an include names it
1001
+ # @param [String] location
1002
+ # @param [String, nil] base Location of the referencing schema
1003
+ # @return Schema, nil
1004
+ def loaded_schema: (untyped location, ?base: untyped?) -> untyped
1005
+
1006
+ # Get first added (considered primary) schema
1007
+ # @return Schema, nil
1008
+ def schema: () -> untyped
1009
+
1010
+ # Get schemas by namespace: those that target it, and what they include — a chameleon schema (one with no
1011
+ # target namespace of its own) as a view in this namespace
1012
+ # @param [String, nil] namespace
1013
+ # @return Array<Schema>
1014
+ def schemas_for_namespace: (untyped namespace) -> untyped
1015
+
1016
+ # A schema with no target namespace, seen as part of the namespace of a schema that includes it ("chameleon"
1017
+ # include): the same document, with everything it declares in that namespace. One view per schema and
1018
+ # namespace, so a schema included into two namespaces declares two sets of definitions.
1019
+ # @param [Schema] source
1020
+ # @param [String] namespace
1021
+ # @return Schema
1022
+ def chameleon: (untyped source, untyped namespace) -> untyped
1023
+
1024
+ # The chameleon views made so far
1025
+ # @return Array<Schema>
1026
+ def chameleons: () -> untyped
1027
+
1028
+ # Every namespace the schemas declare definitions in, includes resolved. A schema with no target namespace
1029
+ # stands for the absent namespace (nil) only when no schema includes it: otherwise what it declares is part
1030
+ # of the namespaces including it.
1031
+ # @return Array<String, nil>
1032
+ def target_namespaces: () -> untyped
1033
+
1034
+ # The schemas that stand on their own, includes resolved: all but those only seen through a chameleon view,
1035
+ # whose definitions belong to the namespaces including them
1036
+ # @return Array<Schema>
1037
+ def standalone_schemas: () -> untyped
1038
+
1039
+ def []: (*untyped args) -> (untyped | nil)
1040
+
1041
+ def elements: (*untyped args) -> untyped
1042
+
1043
+ def attributes: (*untyped args) -> untyped
1044
+
1045
+ def attribute_groups: () -> untyped
1046
+
1047
+ def complex_types: () -> untyped
1048
+
1049
+ def simple_types: () -> untyped
1050
+
1051
+ def groups: () -> untyped
1052
+
1053
+ private
1054
+
1055
+ # Read schema contents from an absolute path or URL
1056
+ # @param [String] location
1057
+ # @param [String, nil] namespace
1058
+ # @return String
1059
+ def read_resource: (untyped location, ?untyped? namespace) -> untyped
1060
+
1061
+ # Resolve a possibly relative location against the location of the referencing schema
1062
+ # @param [String] location
1063
+ # @param [String, nil] base
1064
+ # @return String
1065
+ def expand_location: (untyped location, untyped base) -> untyped
1066
+
1067
+ def collect: (untyped name, *untyped args) -> untyped
1068
+
1069
+ def default_logger: () -> untyped
1070
+ end
1071
+ end