UNPKG

19 kBHTMLView Raw
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <title>JSDoc: Class: XML_ADAPTER</title>
6
7 <script src="scripts/prettify/prettify.js"> </script>
8 <script src="scripts/prettify/lang-css.js"> </script>
9 <!--[if lt IE 9]>
10 <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11 <![endif]-->
12 <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13 <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14</head>
15
16<body>
17
18<div id="main">
19
20 <h1 class="page-title">Class: XML_ADAPTER</h1>
21
22
23
24
25
26
27<section>
28
29<header>
30
31 <h2>XML_ADAPTER</h2>
32
33 <div class="class-description"><p>XML response adapter class which handles wrapping response data in object with status code and result message and converting into XML string.</p></div>
34
35
36</header>
37
38<article>
39 <div class="container-overview">
40
41
42
43
44 <h2>Constructor</h2>
45
46
47 <h4 class="name" id="XML_ADAPTER"><span class="type-signature"></span>new XML_ADAPTER<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
48
49
50
51
52
53
54
55
56
57
58
59
60
61 <h5>Parameters:</h5>
62
63
64<table class="params">
65 <thead>
66 <tr>
67
68 <th>Name</th>
69
70
71 <th>Type</th>
72
73
74 <th>Attributes</th>
75
76
77
78 <th>Default</th>
79
80
81 <th class="last">Description</th>
82 </tr>
83 </thead>
84
85 <tbody>
86
87
88 <tr>
89
90 <td class="name"><code>options</code></td>
91
92
93 <td class="type">
94
95
96<span class="param-type">Object</span>
97
98
99
100 </td>
101
102
103 <td class="attributes">
104
105 &lt;optional><br>
106
107
108
109
110
111 </td>
112
113
114
115 <td class="default">
116
117 {}
118
119 </td>
120
121
122 <td class="description last"><p>Configurable options for XML adapter</p>
123 <h6>Properties</h6>
124
125
126<table class="params">
127 <thead>
128 <tr>
129
130 <th>Name</th>
131
132
133 <th>Type</th>
134
135
136
137
138
139 <th class="last">Description</th>
140 </tr>
141 </thead>
142
143 <tbody>
144
145
146 <tr>
147
148 <td class="name"><code>skip_conversion</code></td>
149
150
151 <td class="type">
152
153
154<span class="param-type">Boolean</span>
155
156
157
158 </td>
159
160
161
162
163
164 <td class="description last"><p>If true render will just return data that is passed to it</p></td>
165 </tr>
166
167
168
169 <tr>
170
171 <td class="name"><code>xml_root</code></td>
172
173
174 <td class="type">
175
176
177<span class="param-type">string</span>
178
179
180
181 </td>
182
183
184
185
186
187 <td class="description last"><p>The value that should be used in generating the root tag of the converted XML document</p></td>
188 </tr>
189
190
191
192 <tr>
193
194 <td class="name"><code>xml_configuration</code></td>
195
196
197 <td class="type">
198
199
200<span class="param-type">Object</span>
201
202
203
204 </td>
205
206
207
208
209
210 <td class="description last"><p>Options that will be passed to the XML conversion function</p></td>
211 </tr>
212
213
214 </tbody>
215</table>
216
217 </td>
218 </tr>
219
220
221 </tbody>
222</table>
223
224
225
226
227
228
229<dl class="details">
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 <dt class="tag-source">Source:</dt>
257 <dd class="tag-source"><ul class="dummy"><li>
258 <a href="adapters_xml_content.js.html">adapters/xml_content.js</a>, <a href="adapters_xml_content.js.html#line59">line 59</a>
259 </li></ul></dd>
260
261
262
263
264
265
266
267</dl>
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285 </div>
286
287
288 <h3 class="subsection-title">Extends</h3>
289
290
291
292
293 <ul>
294 <li>JSON_Adapter</li>
295 </ul>
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311 <h3 class="subsection-title">Methods</h3>
312
313
314
315
316
317
318 <h4 class="name" id="error"><span class="type-signature"></span>error<span class="signature">(err<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
319
320
321
322
323
324<div class="description">
325 <p>Creates a formatted XML error response</p>
326</div>
327
328
329
330
331
332
333
334
335
336 <h5>Parameters:</h5>
337
338
339<table class="params">
340 <thead>
341 <tr>
342
343 <th>Name</th>
344
345
346 <th>Type</th>
347
348
349 <th>Attributes</th>
350
351
352
353 <th>Default</th>
354
355
356 <th class="last">Description</th>
357 </tr>
358 </thead>
359
360 <tbody>
361
362
363 <tr>
364
365 <td class="name"><code>err</code></td>
366
367
368 <td class="type">
369
370
371<span class="param-type">*</span>
372
373
374
375 </td>
376
377
378 <td class="attributes">
379
380 &lt;optional><br>
381
382
383
384
385
386 </td>
387
388
389
390 <td class="default">
391
392 {}
393
394 </td>
395
396
397 <td class="description last"><p>Any data that should be sent with the error response</p></td>
398 </tr>
399
400
401
402 <tr>
403
404 <td class="name"><code>options</code></td>
405
406
407 <td class="type">
408
409
410<span class="param-type">Object</span>
411
412
413
414 </td>
415
416
417 <td class="attributes">
418
419 &lt;optional><br>
420
421
422
423
424
425 </td>
426
427
428
429 <td class="default">
430
431 {}
432
433 </td>
434
435
436 <td class="description last"><p>Configurable options for the XML error response formatting see _ERROR for more details</p>
437 <h6>Properties</h6>
438
439
440<table class="params">
441 <thead>
442 <tr>
443
444 <th>Name</th>
445
446
447 <th>Type</th>
448
449
450 <th>Attributes</th>
451
452
453
454 <th>Default</th>
455
456
457 <th class="last">Description</th>
458 </tr>
459 </thead>
460
461 <tbody>
462
463
464 <tr>
465
466 <td class="name"><code>formatError</code></td>
467
468
469 <td class="type">
470
471
472<span class="param-type">function</span>
473
474
475
476 </td>
477
478
479 <td class="attributes">
480
481 &lt;optional><br>
482
483
484
485
486
487 </td>
488
489
490
491 <td class="default">
492
493 _ERROR
494
495 </td>
496
497
498 <td class="description last"><p>Custom formatting function for XML rendering. It is recommended that the default value for this property is used and only custom options for the XML rendering are passed</p></td>
499 </tr>
500
501
502
503 <tr>
504
505 <td class="name"><code>req</code></td>
506
507
508 <td class="type">
509
510
511<span class="param-type">Object</span>
512
513
514
515 </td>
516
517
518 <td class="attributes">
519
520 &lt;optional><br>
521
522
523
524
525
526 </td>
527
528
529
530 <td class="default">
531
532 </td>
533
534
535 <td class="description last"><p>Express request object. If options.req and options.res are defined the express .render method will be used to render template</p></td>
536 </tr>
537
538
539
540 <tr>
541
542 <td class="name"><code>res</code></td>
543
544
545 <td class="type">
546
547
548<span class="param-type">Object</span>
549
550
551
552 </td>
553
554
555 <td class="attributes">
556
557 &lt;optional><br>
558
559
560
561
562
563 </td>
564
565
566
567 <td class="default">
568
569 </td>
570
571
572 <td class="description last"><p>Express response object. If options.res and options.req are defined the express .render method will be used to render template</p></td>
573 </tr>
574
575
576
577 <tr>
578
579 <td class="name"><code>skip_response</code></td>
580
581
582 <td class="type">
583
584
585<span class="param-type">Boolean</span>
586
587
588
589 </td>
590
591
592 <td class="attributes">
593
594 &lt;optional><br>
595
596
597
598
599
600 </td>
601
602
603
604 <td class="default">
605
606 </td>
607
608
609 <td class="description last"><p>If true function will resolve with the rendered template instead of sending a response</p></td>
610 </tr>
611
612
613 </tbody>
614</table>
615
616 </td>
617 </tr>
618
619
620
621 <tr>
622
623 <td class="name"><code>cb</code></td>
624
625
626 <td class="type">
627
628
629<span class="param-type">function</span>
630
631
632
633 </td>
634
635
636 <td class="attributes">
637
638 &lt;optional><br>
639
640
641
642
643
644 </td>
645
646
647
648 <td class="default">
649
650 false
651
652 </td>
653
654
655 <td class="description last"><p>Optional callback function. If argument is not a function it will be ignored</p></td>
656 </tr>
657
658
659 </tbody>
660</table>
661
662
663
664
665
666
667<dl class="details">
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 <dt class="tag-source">Source:</dt>
695 <dd class="tag-source"><ul class="dummy"><li>
696 <a href="adapters_xml_content.js.html">adapters/xml_content.js</a>, <a href="adapters_xml_content.js.html#line103">line 103</a>
697 </li></ul></dd>
698
699
700
701
702
703
704
705</dl>
706
707
708
709
710
711
712
713
714
715
716
717
718
719<h5>Returns:</h5>
720
721
722<div class="param-desc">
723 <p>Returns the formatted XML string if options.sync is true or a Promise if cb arugement is not passed</p>
724</div>
725
726
727
728<dl>
729 <dt>
730 Type
731 </dt>
732 <dd>
733
734<span class="param-type">*</span>
735
736
737 </dd>
738</dl>
739
740
741
742
743
744
745
746
747
748
749 <h4 class="name" id="render"><span class="type-signature"></span>render<span class="signature">(data, options<span class="signature-attributes">opt</span>, cb<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
750
751
752
753
754
755<div class="description">
756 <p>Creates a formatted XML response</p>
757</div>
758
759
760
761
762
763
764
765
766
767 <h5>Parameters:</h5>
768
769
770<table class="params">
771 <thead>
772 <tr>
773
774 <th>Name</th>
775
776
777 <th>Type</th>
778
779
780 <th>Attributes</th>
781
782
783
784 <th>Default</th>
785
786
787 <th class="last">Description</th>
788 </tr>
789 </thead>
790
791 <tbody>
792
793
794 <tr>
795
796 <td class="name"><code>data</code></td>
797
798
799 <td class="type">
800
801
802<span class="param-type">*</span>
803
804
805
806 </td>
807
808
809 <td class="attributes">
810
811
812
813
814
815 </td>
816
817
818
819 <td class="default">
820
821 </td>
822
823
824 <td class="description last"><p>Any data that should be sent with the success response</p></td>
825 </tr>
826
827
828
829 <tr>
830
831 <td class="name"><code>options</code></td>
832
833
834 <td class="type">
835
836
837<span class="param-type">Object</span>
838
839
840
841 </td>
842
843
844 <td class="attributes">
845
846 &lt;optional><br>
847
848
849
850
851
852 </td>
853
854
855
856 <td class="default">
857
858 {}
859
860 </td>
861
862
863 <td class="description last"><p>Configurable options for the XML success response formatting see _RENDER for more details</p>
864 <h6>Properties</h6>
865
866
867<table class="params">
868 <thead>
869 <tr>
870
871 <th>Name</th>
872
873
874 <th>Type</th>
875
876
877 <th>Attributes</th>
878
879
880
881 <th>Default</th>
882
883
884 <th class="last">Description</th>
885 </tr>
886 </thead>
887
888 <tbody>
889
890
891 <tr>
892
893 <td class="name"><code>formatRender</code></td>
894
895
896 <td class="type">
897
898
899<span class="param-type">function</span>
900
901
902
903 </td>
904
905
906 <td class="attributes">
907
908 &lt;optional><br>
909
910
911
912
913
914 </td>
915
916
917
918 <td class="default">
919
920 _RENDER
921
922 </td>
923
924
925 <td class="description last"><p>Custom formatting function for XML rendering. It is recommended that the default value for this property is used and only custom options for the XML rendering are passed</p></td>
926 </tr>
927
928
929 </tbody>
930</table>
931
932 </td>
933 </tr>
934
935
936
937 <tr>
938
939 <td class="name"><code>cb</code></td>
940
941
942 <td class="type">
943
944
945<span class="param-type">function</span>
946
947
948
949 </td>
950
951
952 <td class="attributes">
953
954 &lt;optional><br>
955
956
957
958
959
960 </td>
961
962
963
964 <td class="default">
965
966 false
967
968 </td>
969
970
971 <td class="description last"><p>Optional callback function. If argument is not a function it will be ignored</p></td>
972 </tr>
973
974
975
976 <tr>
977
978 <td class="name"><code>options.req</code></td>
979
980
981 <td class="type">
982
983
984<span class="param-type">Object</span>
985
986
987
988 </td>
989
990
991 <td class="attributes">
992
993 &lt;optional><br>
994
995
996
997
998
999 </td>
1000
1001
1002
1003 <td class="default">
1004
1005 </td>
1006
1007
1008 <td class="description last"><p>Express request object. If options.req and options.res are defined the express .render method will be used to render template</p></td>
1009 </tr>
1010
1011
1012
1013 <tr>
1014
1015 <td class="name"><code>options.res</code></td>
1016
1017
1018 <td class="type">
1019
1020
1021<span class="param-type">Object</span>
1022
1023
1024
1025 </td>
1026
1027
1028 <td class="attributes">
1029
1030 &lt;optional><br>
1031
1032
1033
1034
1035
1036 </td>
1037
1038
1039
1040 <td class="default">
1041
1042 </td>
1043
1044
1045 <td class="description last"><p>Express response object. If options.res and options.req are defined the express .render method will be used to render template</p></td>
1046 </tr>
1047
1048
1049
1050 <tr>
1051
1052 <td class="name"><code>options.skip_response</code></td>
1053
1054
1055 <td class="type">
1056
1057
1058<span class="param-type">Boolean</span>
1059
1060
1061
1062 </td>
1063
1064
1065 <td class="attributes">
1066
1067 &lt;optional><br>
1068
1069
1070
1071
1072
1073 </td>
1074
1075
1076
1077 <td class="default">
1078
1079 </td>
1080
1081
1082 <td class="description last"><p>If true function will resolve with the rendered template instead of sending a response</p></td>
1083 </tr>
1084
1085
1086 </tbody>
1087</table>
1088
1089
1090
1091
1092
1093
1094<dl class="details">
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121 <dt class="tag-source">Source:</dt>
1122 <dd class="tag-source"><ul class="dummy"><li>
1123 <a href="adapters_xml_content.js.html">adapters/xml_content.js</a>, <a href="adapters_xml_content.js.html#line84">line 84</a>
1124 </li></ul></dd>
1125
1126
1127
1128
1129
1130
1131
1132</dl>
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146<h5>Returns:</h5>
1147
1148
1149<div class="param-desc">
1150 <p>Returns the formatted XML string if options.sync is true or a Promise if cb arugement is not passed</p>
1151</div>
1152
1153
1154
1155<dl>
1156 <dt>
1157 Type
1158 </dt>
1159 <dd>
1160
1161<span class="param-type">*</span>
1162
1163
1164 </dd>
1165</dl>
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177</article>
1178
1179</section>
1180
1181
1182
1183
1184</div>
1185
1186<nav>
1187 <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CONTENT_ADAPTER_INTERFACE.html">CONTENT_ADAPTER_INTERFACE</a></li><li><a href="HTML_ADAPTER.html">HTML_ADAPTER</a></li><li><a href="JSON_ADAPTER.html">JSON_ADAPTER</a></li><li><a href="XML_ADAPTER.html">XML_ADAPTER</a></li></ul><h3>Global</h3><ul><li><a href="global.html#_ERROR">_ERROR</a></li><li><a href="global.html#_RENDER">_RENDER</a></li><li><a href="global.html#findValidViewFromPaths">findValidViewFromPaths</a></li></ul>
1188</nav>
1189
1190<br class="clear">
1191
1192<footer>
1193 Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Dec 22 2016 14:40:44 GMT-0500 (EST)
1194</footer>
1195
1196<script> prettyPrint(); </script>
1197<script src="scripts/linenumber.js"> </script>
1198</body>
1199</html>
\No newline at end of file