summaryrefslogtreecommitdiff
path: root/vendor/thecodingmachine/safe/generated/xml.php
blob: 6f2679dd68e8457cb6081a8c30a6f9893aebf92d (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<?php

namespace Safe;

use Safe\Exceptions\XmlException;

/**
 * Frees the given XML parser.
 *
 * @param resource $parser
 * @throws XmlException
 *
 */
function xml_parser_free($parser): void
{
    error_clear_last();
    $result = \xml_parser_free($parser);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the character data handler function for the XML parser
 * parser.
 *
 * @param resource $parser A reference to the XML parser to set up character data handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * two parameters:
 *
 * handler
 * XMLParserparser
 * stringdata
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * data
 *
 *
 * The second parameter, data, contains
 * the character data as a string.
 *
 *
 *
 *
 *
 * Character data handler is called for every piece of a text in the XML
 * document. It can be called multiple times inside each fragment (e.g.
 * for non-ASCII strings).
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_character_data_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_character_data_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the default handler function for the XML parser
 * parser.
 *
 * @param resource $parser A reference to the XML parser to set up default handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * two parameters:
 *
 * handler
 * XMLParserparser
 * stringdata
 *
 *
 *
 *
 * parser
 *
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 *
 * data
 *
 *
 *
 * The second parameter, data, contains
 * the character data.This may be the XML declaration,
 * document type declaration, entities or other data for which
 * no other handler exists.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_default_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_default_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the element handler functions for the XML parser.
 * start_handler and
 * end_handler are strings containing
 * the names of functions that must exist when xml_parse
 * is called for parser.
 *
 * @param resource $parser A reference to the XML parser to set up start and end element handler functions.
 * @param callable $start_handler The function named by start_handler
 * must accept three parameters:
 *
 * start_element_handler
 * XMLParserparser
 * stringname
 * arrayattribs
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * name
 *
 *
 * The second parameter, name, contains the name
 * of the element for which this handler is called.If case-folding is in effect for this
 * parser, the element name will be in uppercase letters.
 *
 *
 *
 *
 * attribs
 *
 *
 * The third parameter, attribs, contains an
 * associative array with the element's attributes (if any).The keys
 * of this array are the attribute names, the values are the attribute
 * values.Attribute names are case-folded on the same criteria as
 * element names.Attribute values are not
 * case-folded.
 *
 *
 * The original order of the attributes can be retrieved by walking
 * through attribs the normal way, using
 * each.The first key in the array was the first
 * attribute, and so on.
 *
 *
 *
 *
 * @param callable $end_handler
 * @throws XmlException
 *
 */
function xml_set_element_handler($parser, callable $start_handler, callable $end_handler): void
{
    error_clear_last();
    $result = \xml_set_element_handler($parser, $start_handler, $end_handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Set a handler to be called when leaving the scope of a namespace
 * declaration. This will be called, for each namespace declaration, after
 * the handler for the end tag of the element in which the namespace was
 * declared.
 *
 * @param resource $parser A reference to the XML parser.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * two parameters, and should return an integer value. If the
 * value returned from the handler is FALSE (which it will be if no
 * value is returned), the XML parser will stop parsing and
 * xml_get_error_code will return
 * XML_ERROR_EXTERNAL_ENTITY_HANDLING.
 *
 * handler
 * XMLParserparser
 * stringprefix
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * prefix
 *
 *
 * The prefix is a string used to reference the namespace within an XML object.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_end_namespace_decl_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_end_namespace_decl_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the external entity reference handler function for the XML parser
 * parser.
 *
 * @param resource $parser A reference to the XML parser to set up external entity reference handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * five parameters, and should return an integer value.If the
 * value returned from the handler is FALSE (which it will be if no
 * value is returned), the XML parser will stop parsing and
 * xml_get_error_code will return
 * XML_ERROR_EXTERNAL_ENTITY_HANDLING.
 *
 * handler
 * XMLParserparser
 * stringopen_entity_names
 * stringbase
 * stringsystem_id
 * stringpublic_id
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * open_entity_names
 *
 *
 * The second parameter, open_entity_names, is a
 * space-separated list of the names of the entities that are open for
 * the parse of this entity (including the name of the referenced
 * entity).
 *
 *
 *
 *
 * base
 *
 *
 * This is the base for resolving the system identifier
 * (system_id) of the external entity.Currently
 * this parameter will always be set to an empty string.
 *
 *
 *
 *
 * system_id
 *
 *
 * The fourth parameter, system_id, is the
 * system identifier as specified in the entity declaration.
 *
 *
 *
 *
 * public_id
 *
 *
 * The fifth parameter, public_id, is the
 * public identifier as specified in the entity declaration, or
 * an empty string if none was specified; the whitespace in the
 * public identifier will have been normalized as required by
 * the XML spec.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_external_entity_ref_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_external_entity_ref_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the notation declaration handler function for the XML parser
 * parser.
 *
 * A notation declaration is part of the document's DTD and has the
 * following format:
 *
 * name
 * { systemId | publicId?>
 * ]]>
 *
 * See section 4.7 of the XML 1.0
 * spec for the definition of notation declarations.
 *
 * @param resource $parser A reference to the XML parser to set up notation declaration handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * five parameters:
 *
 * handler
 * XMLParserparser
 * stringnotation_name
 * stringbase
 * stringsystem_id
 * stringpublic_id
 *
 *
 *
 *
 * parser
 *
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * notation_name
 *
 *
 * This is the notation's name, as per
 * the notation format described above.
 *
 *
 *
 *
 *
 * base
 *
 *
 *
 * This is the base for resolving the system identifier
 * (system_id) of the notation declaration.
 * Currently this parameter will always be set to an empty string.
 *
 *
 *
 *
 * system_id
 *
 *
 * System identifier of the external notation declaration.
 *
 *
 *
 *
 *
 * public_id
 *
 *
 *
 * Public identifier of the external notation declaration.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_notation_decl_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_notation_decl_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * This function allows to use parser inside
 * object. All callback functions could be set with
 * xml_set_element_handler etc and assumed to be
 * methods of object.
 *
 * @param resource $parser A reference to the XML parser to use inside the object.
 * @param object $object The object where to use the XML parser.
 * @throws XmlException
 *
 */
function xml_set_object($parser, object $object): void
{
    error_clear_last();
    $result = \xml_set_object($parser, $object);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the processing instruction (PI) handler function for the XML parser
 * parser.
 *
 * A processing instruction has the following format:
 *
 * &lt;?target
 * data?&gt;
 *
 *
 * You can put PHP code into such a tag, but be aware of one limitation: in
 * an XML PI, the PI end tag (?&gt;) can not be quoted,
 * so this character sequence should not appear in the PHP code you embed
 * with PIs in XML documents.If it does, the rest of the PHP code, as well
 * as the "real" PI end tag, will be treated as character data.
 *
 * @param resource $parser A reference to the XML parser to set up processing instruction (PI) handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * three parameters:
 *
 * handler
 * XMLParserparser
 * stringtarget
 * stringdata
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * target
 *
 *
 * The second parameter, target, contains the PI
 * target.
 *
 *
 *
 *
 * data
 *
 *
 * The third parameter, data, contains the PI
 * data.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_processing_instruction_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_processing_instruction_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Set a handler to be called when a namespace is declared. Namespace
 * declarations occur inside start tags. But the namespace declaration start
 * handler is called before the start tag handler for each namespace declared
 * in that start tag.
 *
 * @param resource $parser A reference to the XML parser.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept
 * three parameters, and should return an integer value. If the
 * value returned from the handler is FALSE (which it will be if no
 * value is returned), the XML parser will stop parsing and
 * xml_get_error_code will return
 * XML_ERROR_EXTERNAL_ENTITY_HANDLING.
 *
 * handler
 * XMLParserparser
 * stringprefix
 * stringuri
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the handler.
 *
 *
 *
 *
 * prefix
 *
 *
 * The prefix is a string used to reference the namespace within an XML object.
 *
 *
 *
 *
 * uri
 *
 *
 * Uniform Resource Identifier (URI) of namespace.
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_start_namespace_decl_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_start_namespace_decl_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}


/**
 * Sets the unparsed entity declaration handler function for the XML parser
 * parser.
 *
 * The handler will be called if the XML parser
 * encounters an external entity declaration with an NDATA declaration, like
 * the following:
 *
 * name {publicId | systemId}
 * NDATA notationName
 * ]]>
 *
 *
 * See section 4.2.2 of
 * the XML 1.0 spec for the definition of notation declared
 * external entities.
 *
 * @param resource $parser A reference to the XML parser to set up unparsed entity declaration handler function.
 * @param callable $handler handler is a string containing the name of a
 * function that must exist when xml_parse is called
 * for parser.
 *
 * The function named by handler must accept six
 * parameters:
 *
 * handler
 * XMLParserparser
 * stringentity_name
 * stringbase
 * stringsystem_id
 * stringpublic_id
 * stringnotation_name
 *
 *
 *
 * parser
 *
 *
 * The first parameter, parser, is a
 * reference to the XML parser calling the
 * handler.
 *
 *
 *
 *
 * entity_name
 *
 *
 * The name of the entity that is about to be defined.
 *
 *
 *
 *
 * base
 *
 *
 * This is the base for resolving the system identifier
 * (systemId) of the external entity.Currently
 * this parameter will always be set to an empty string.
 *
 *
 *
 *
 * system_id
 *
 *
 * System identifier for the external entity.
 *
 *
 *
 *
 * public_id
 *
 *
 * Public identifier for the external entity.
 *
 *
 *
 *
 * notation_name
 *
 *
 * Name of the notation of this entity (see
 * xml_set_notation_decl_handler).
 *
 *
 *
 *
 *
 * If a handler function is set to an empty string, or FALSE, the handler
 * in question is disabled.
 * @throws XmlException
 *
 */
function xml_set_unparsed_entity_decl_handler($parser, callable $handler): void
{
    error_clear_last();
    $result = \xml_set_unparsed_entity_decl_handler($parser, $handler);
    if ($result === false) {
        throw XmlException::createFromPhpError();
    }
}